This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes send email using gmail account Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "send email using gmail account" Watch "send email using gmail account" New topic

send email using gmail account

Harry Sunarsa

Joined: Feb 15, 2012
Posts: 9
hi guys,

please help, I'm creating an application for sending an email that use gmail account as sender. but always return the exception, as shown below:

and here it is my program that i got from some forum

I have tried to use both port 465 & 587 but still always return error...

thanks in advance,
Rob Spoor

Joined: Oct 27, 2005
Posts: 19651

Welcome to the Ranch! Can you please UseCodeTags next time? See how much easier your code is to read with them.

How To Ask Questions How To Answer Questions
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

The code which you scavenged from the web is out of date. Check out the JavaMail FAQ which has a section specifically about using GMail.
It is sorta covered in the JavaRanch Style Guide.
subject: send email using gmail account
Similar Threads
Unknown SMTP host for gmail
problem in mailing with smtp server
how to send mail using gmail server
Java Mail
Error in sending mail using ssl server