Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Email cound not be sent in web app

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 6527
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the following exception:

 
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic