aspose file tools*
The moose likes Java in General and the fly likes Mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Mail" Watch "Mail" New topic
Author

Mail

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi
I want to send an SMTP mail message using Java. I have access to a server running SMTP protocol. What API is available to do this?
Is JavaMail suitable?
Thanks in advance
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Someone else asked this, and I gave a code example and installation/running examples here.
Have fun.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Originally posted by Frank Carver:
Someone else asked this, and I gave a code example and installation/running examples here.
Have fun.

Hi Frank

Thanks for ur help. I tried the code which u have given and I get this exception


Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/Data
Source
at Mailer.sendMail(Mailer.java:27)
at Mailer.main(Mailer.java:44)



Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Sorry for the delay in replying, I was on vacation.
It looks as if you haven't added the "activation.jar" to your classpath or lib/ext directory as described in my instructions.
Remember that Java Mail needs both "mail.jar" and "activation.jar".
Ramana Prakash
Greenhorn

Joined: Aug 23, 2001
Posts: 1
Hi Frank,

I am using javamail to send mails and that works at almost all locations,But I have a small problem at one location where we have only SMTP provider. mail.jar and activation.jar files only works on ESMTP provider. Do u have any idea about sending mails using only SMTP.
Tahnks in Advance
------------------
Ramana
Sierra Atlantic.
510-742-4270


Ramana <BR>Sierra Atlantic.<BR>510-742-4270
jainrahul
Greenhorn

Joined: Jul 09, 2002
Posts: 1
WHile running a java program in windows to read and save an attachment from a mail the following error occurs,the program works properly on sun machine their is some problem regardinf class path but i am not able to fix it.
can somebody help me in debugging this error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/Data
Source
at com.sun.mail.pop3.POP3Folder.createMessage(POP3Folder.java:284)
at com.sun.mail.pop3.POP3Folder.getMessage(POP3Folder.java:265)
at javax.mail.Folder.getMessages(Folder.java:903)
at receive.main(receive.java:30)
Jigar Gosar
Ranch Hand

Joined: Jul 09, 2002
Posts: 95
well frank the link for mail api no longer works please update it


Regards,<br />Jigar Gosar (SCJP 1.4)<br />visit: <a href="http://jigar.org/blog" target="_blank" rel="nofollow">http://jigar.org/blog</a>
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
updated link


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Mail