File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes Email cound not be sent in web app Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "Email cound not be sent in web app" Watch "Email cound not be sent in web app" New topic
Author

Email cound not be sent in web app

Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Hi friends,

I have some code that sends out an email from GMail. It is working on a command line program but it does not work in a Servlet. It throws an exception saying something like AuthenticationException.
But I double checked the code, it is almost the same for both command line program and Servlet. I don't understand why it behaves so strangely!

Any idea?

Thanks.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2329
It's hard to advise about this without seeing the full stack trace or the code that causes it. For starters, make sure you#re doing things exactly as described in http://www.oracle.com/technetwork/java/faq-135477.html#gmail
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
I got the following exception:

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 13842

I would set JavaMail's debug mode on and send an e-mail in both environments: the one where authentication is successful and the one where it fails. See what is different.
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Paul Clapham wrote:I would set JavaMail's debug mode on and send an e-mail in both environments: the one where authentication is successful and the one where it fails. See what is different.


Thanks, I will try in the debug mode then let you know.
 
 
subject: Email cound not be sent in web app
 
Threads others viewed
Java package problem with package.*
How to use Cron job with Java program?
how to send email from servlet program
Cannot find symbol
Tomcat4.0 exceptions
IntelliJ Java IDE