Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Run msgsend.java 1.5.4 with Gmail SMTP Server
How to run msgsend.java with javax.mail-1.5.4.jar with Gmail using SSL POP3 protocol? I have a valid Gmail email account.
✍: FYIcenter.com

msgsend.java in javamail-samples.zip can be used to send out a simple text mail message through Gmail server using SSL SMTP protocol. Here is an execution session of msgsend.java with javax.mail-1.5.4.jar:
fyicenter>cd \local\javamail-1.5.4\javamail-samples
local\javamail-1.5.4\javamail-samples>java -version
java version "1.8.0_45"
local\javamail-1.5.4\javamail-samples>javac -cp .;..\javax.mail-1.5.4.jar
   msgsend.java
local\javamail-1.5.4\javamail-samples>java -cp .;..\javax.mail-1.5.4.jar
   -Dmail.smtp.ssl.enable=true msgsend
   -d -M smtp.gmail.com john@yahoo.com
To: john@yahoo.com
Subject: Test with JavaMail 1.5.4
DEBUG: setDebug: JavaMail version 1.5.4
John, how are you?
^Z
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s
mtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL true
220 smtp.gmail.com ESMTP h83sm32129867ywc.6 - gsmtp
DEBUG SMTP: connected to host "smtp.gmail.com", port: 465
EHLO localhost
250-smtp.gmail.com at your service, [71.174.32.174]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
DEBUG SMTP: Found extension "SIZE", arg "35882577"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN O
AUTHBEARER XOAUTH"
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "SMTPUTF8", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<john@localhost>
530-5.5.1 Authentication Required. Learn more at
530 5.5.1  https://support.google.com/mail/answer/14257 h83sm32129867ywc.6 - gsm
tp
DEBUG SMTP: got response code 530, with response: 530-5.5.1 Authentication Requi
red. Learn more at
530 5.5.1  https://support.google.com/mail/answer/14257 h83sm32129867ywc.6 - gsm
tp
RSET
250 2.1.5 Flushed h83sm32129867ywc.6 - gsmtp
DEBUG SMTP: MessagingException while sending, THROW:
com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. Le
arn more at
530 5.5.1  https://support.google.com/mail/answer/14257 h83sm32129867ywc.6 - gsm
tp
        at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2
203)
        at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1694)
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1194)
        at javax.mail.Transport.send0(Transport.java:254)
        at javax.mail.Transport.send(Transport.java:124)
        at msgsend.main(msgsend.java:188)
QUIT
The output shows that:
⇒ Download and Install javamail1_4_7.zip
⇐ msgsend sample Program with JavaMail 1.5.4
2016-01-15, ∼2743🔥, 0💬
Popular Posts:
How to download and install JDK (Java Development Kit) 6? If you want to write Java applications, yo...
maven-compat-3.5.4.jar is the JAR file for Apache Maven 3.5.4 Compact module. The JAR file name may ...
A stream buffer is a stream-based representation of an XML infoset in Java. Stream buffers are desig...
What Is poi-3.5.jar - Part 2? poi-3.5.jar is one of the JAR files for Apache POI 3.5, which provides...
What Is poi-3.5.jar - Part 2? poi-3.5.jar is one of the JAR files for Apache POI 3.5, which provides...