Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mail

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone else asked this, and I gave a code example and installation/running examples here.
Have fun.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
jainrahul
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well frank the link for mail api no longer works please update it
 
Marilyn de Queiroz
Sheriff
Posts: 9065
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
updated link
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic