wood burning stoves*
The moose likes Other JSE/JEE APIs and the fly likes sending mail using javamail and gmail smtp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "sending mail using javamail and gmail smtp" Watch "sending mail using javamail and gmail smtp" New topic
Author

sending mail using javamail and gmail smtp

jimmy vancura
Greenhorn

Joined: Aug 02, 2009
Posts: 1
hello, this is my first post here. thanks in advance if anyone has any help. i am using javamail to send messages using the gmail smtp server and have been all over the place as far as looking for help and trying different configurations. right now i have code that appears to connect and attempt to send mail but seems to 'hang' at a spot in the debug messages where is simply says QUIT and seems to have my message content pre-pended to the same line. i will be using the email class i am writing in a servlet but for now am just trying to get a few messages sent so everything is hard coded. below is my code and the debug output. the email addresses and passwords i am using are valid but i changed them for the post. sorry if the output is long. thanks again!



**debug output**

DEBUG: JavaMail version 1.3.2
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.6.0_03\lib\javamail.providers (The system cannot find the file specified)
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.address.map
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.6.0_03\lib\javamail.address.map (The system cannot find the file specified)
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 25, isSSL false
220 mx.google.com ESMTP b7sm106009ana.17
DEBUG SMTP: connected to host "smtp.gmail.com", port: 465

EHLO Jimmy
250-mx.google.com at your service, [174.99.103.178]
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250 PIPELINING
DEBUG SMTP: Found extension "SIZE", arg "35651584"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN"
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Attempt to authenticate
AUTH LOGIN
334 VXNlcm5hbWU6
amltbXkudmFuY3VyYUBnbWFpbC5jb20=
334 UGFzc3dvcmQ6
bXRuYmtyNzc=
235 2.7.0 Accepted
DEBUG SMTP: use8bit false
MAIL FROM:<fromuser@gmail.com>
250 2.1.0 OK b7sm106009ana.17
RCPT TO:<touser@gmail.com>
250 2.1.5 OK b7sm106009ana.17
DEBUG SMTP: Verified Addresses
DEBUG SMTP: touser@gmail.com
DATA
354 Go ahead b7sm106009ana.17
Message-ID: <5487165.1249226262359.JavaMail.JimmyV@Jimmy>
From: Account Administration <fromuser@gmail.com>
To: touser@gmail.com
Subject: test subject
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

test email message.QUIT

**end debug output**

the 'test email message.QUIT' will sit indefinitely.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sending mail using javamail and gmail smtp
 
Similar Threads
javax.mail.NoSuchProviderException: smtp
Java mail
Must issue a starttls command
My Application is not sending mail to external servers
problem sending mail to other domains