Link to home
Start Free TrialLog in
Avatar of hongjun
hongjunFlag for Singapore

asked on

JavaMail

I am using J2EE.
Anyone can provide sample codes using JavaMail to send an email?


hongjun
ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Naeemg
Naeemg

Avatar of hongjun

ASKER

I got NoClassDefFoundError.
I am suspecting my classpath is incorrect for javamail.

hongjun
Avatar of hongjun

ASKER

BTW, I have included activation.jar and mail.jar but still not working.
I am using this code
http://www.javaworld.com/javaworld/jw-10-2001/jw-1026-javamail.html
Which class is not being found? The mail ones or the main class? Have you checked the package declaration?
Avatar of hongjun

ASKER

Thanks I got it to work.
However, I do have some queries.

The code example shows that you just need to include a smtp server address. However, username and password are omitted. I would prefer to enter them. Can help?

hongjun
Avatar of hongjun

ASKER

How to set a classpath in NetBeans?
It doesn't seem to be able to compile using netbeans because of classpath problem.

hongjun
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If it's anything like Eclipse, right click on the project and select Java/build Path/ add jars
>> How to set a classpath in NetBeans?
In netBeans you have to mount a jar to make it "available"

Thanks for accepting