Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-13-2007, 03:23 PM
Member
 
Join Date: Jul 2007
Posts: 44
simon is on a distinguished road
530 5.7.0 Authentication Required - JavaMail gmail
I'm trying to send mail using JAVAMAIL API with GMAIL SMTP.
Now, I setup my outlook smtp.gmail.com with port 465 and I was able to send email using outlook when I tried the same with javamail, but this error appears

Code:
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Su n Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth false DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false 220 mx.gmail.com ESMTP i20sm2352180wxd DEBUG SMTP: connected to host "smtp.gmail.com", port: 465 EHLO vkat 250-mx.gmail.com at your service 250-SIZE 20971520 250-8BITMIME 250-AUTH LOGIN PLAIN 250 ENHANCEDSTATUSCODES DEBUG SMTP: Found extension "SIZE", arg "20971520" DEBUG SMTP: Found extension "8BITMIME", arg "" DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN" DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg "" DEBUG SMTP: use8bit false MAIL FROM:<vkat007@gmail.com> 530 5.7.0 Authentication Required i20sm2352180wxd com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Authentication Required i20sm2352180wxd at com.sun.mail.smtp.SMTPTransport.issueSendCommand (SMTPTransport.java:1333)
this is my code:
Code:
Properties p = new Properties(); p.put("mail.smtp.user", "vkat007@gmail.com"); p.put("mail.smtp.host", mailhost); p.put("mail.smtp.port", "465"); p.put("mail.smtp.starttls.enable","true"); p.put( "mail.smtp.auth ", "true "); p.put("mail.smtp.debug", "true"); p.put("mail.smtp.socketFactory.port", "465"); p.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); p.put("mail.smtp.socketFactory.fallback", "false"); SecurityManager security = System.getSecurityManager(); System.out.println("Security Manager" + security); try { Authenticator auth = new SMTPAuthenticator(); Session session = Session.getInstance(p, auth); session.setDebug(true); //session = Session.getDefaultInstance(p); MimeMessage msg = new MimeMessage(session); msg.setText(text); msg.setSubject(subject); Address fromAddr = new InternetAddress("vkat007@gmail.com"); msg.setFrom(fromAddr); Address toAddr = new InternetAddress(_to); msg.addRecipient(Message.RecipientType.TO, toAddr); System.out.println("Message: " + msg.getContent()); Transport.send(msg); } catch (Exception mex) { // Prints all nested (chained) exceptions as well System.out.println("I am here??? "); mex.printStackTrace(); } } private class SMTPAuthenticator extends javax.mail.Authenticator { public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication ("vkat007@gmail.com", "xxxxxxxxxxx"); // password not displayed here, but gave the right password in my actual code. } }
any ideas?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-15-2007, 12:52 AM
Member
 
Join Date: Jul 2007
Posts: 36
boy22 is on a distinguished road
You have some extra spaces in the following line:
Code:
p.put( "mail.smtp.auth ", "true ");
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javamail v_mallikarjun Advanced Java 14 04-18-2008 08:32 PM
Using JavaMail API consult4u Networking 0 08-09-2007 11:15 AM
How to access yahoo/gmail/hotmail address book shahinengg AWT / Swing 0 08-04-2007 05:53 AM
This is Regarding JSP with javamail venkatkomalli Advanced Java 3 07-19-2007 03:07 PM
JavaMail:Authentication required error bbq Advanced Java 1 07-05-2007 05:16 AM


All times are GMT +3. The time now is 12:30 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org