Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

sending automatic javamail from a website using java mail API

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Below is my code for sending an automatic mail on registration from my website:





And when i run this on my eclipse its throwing exception the stack trace is as below:







And the jar files i have in my eclipse build path are javax.mail.jar , activation.jar, commons-email-1.0.jar Please help me resolve this... Thanks in advance...

 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing JDBC related here, moving to a better forum...
 
sunaina agarwal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry by mistake i posted it here .... How to move it to another forum... Should i have to close this and post a new question in the another forum or is there any other way to do it??
 
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, it's OK, Martin moved it already.

587 is the Gmail TLS port, not the SSL port (which would be 465). You need to set some properties accordingly: http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/
 
sunaina agarwal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@UlfDittmer hey i used the code from MK yong only but it was giving me some exception like "must issue STARTTLS command first" then i added a new jar file javaxmail.jar of version1.5. then it worked and now its giving me the exception as in the above question... Am banging my head on this issue from last three days please help me resolve this..
 
Ulf Dittmer
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said, the properties you're using enable SSL, not TLS, so your code differs from the code in the article.
 
sunaina agarwal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
k i tried the same code as in the article so its giving me this exception now:




Sorry i had to post the whole stack trace because its giving me this exception every time i run it .
 
sunaina agarwal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i resolved this by adding just one line of code:



It worked like miracle... thank you all.....
reply
    Bookmark Topic Watch Topic
  • New Topic