Categories:
Audio (13)
Biotech (29)
Bytecode (22)
Database (79)
Framework (7)
Game (7)
General (454)
Graphics (53)
I/O (28)
IDE (2)
JAR Tools (45)
JavaBeans (16)
JDBC (86)
JDK (33)
JSP (20)
Logging (89)
Mail (54)
Messaging (8)
Network (103)
PDF (82)
Report (7)
Scripting (75)
Security (67)
Server (112)
Servlet (11)
SOAP (24)
Testing (55)
Web (24)
XML (287)
Other Resources:
msgsend Demo Program in JavaMail 1.4.7
What is the msgsend.java in javamail1_4_7.zip?
✍: FYIcenter.com
msgsend.java in javamail1_4_7.zip is a demo program that sends out a simple text email message through a SMTP server.
msgsend.java is located at \local\javamail-1.4.7\demo\msgsend.java. Below is the usage description of msgsend.java:
Description: Send a simple text message. Optionally saves a copy of the outgoing message in a folder (record-folder). Most parameters to this program are optional. When the program is run, it interactively asks for the "To" and "Subject" fields if not already available. Then the program expects the body of the message. After you type in the body, hit Ctrl-D on Unix systems or Ctrl-Z on Windows systems to send the message. Usage: java msgsend -L <store-url> -T <protocol> -H <host> -U <user> -P <passwd> -s <subject> -o <from> -c <cc> -b <bcc> -f <record> -M <smtphost> [-d] <to> Options: -L <store-url> : URL of the store for the record-folder -T <protocol> : If <store-url> is not present, this indicates the store protocol for the record-folder. -H <host> : If <store-url> is not present, this indicates the hostname for the record-folder. -U <user> : If <store-url> is not present, this indicates the username for the record-folder. -P <passwd> : If <store-url> is not present, this indicates the password for the record-folder. -f <record> : name of record-folder. -M <smtphost> : Host name of SMTP server. Defaults to "localhost" which often works on UNIX but rarely on Windows. -s <subject> : Subject of message to be sent -o <from> : From address of message to be sent -c <cc> : Cc address of message to be sent -b <bcc> : Bcc address of message to be sent -d : Turn on session debugging. -a <file> : Include file as an attachment with the message Argument: <to> : To address of message to be sentHere is an execution session of msgsend.java:
fyicenter>cd \local\javamail-1.4.7\demo local\javamail-1.4.7\demo>java -version java version "1.8.0_45" local\javamail-1.4.7\demo>javac -cp ..\mail.jar msgsend.java local\javamail-1.4.7\demo>java -cp .;..\mail.jar msgsend -d -M smtp.junkmail.com john@yahoo.com To: john@yahoo.com Subject: Test DEBUG: setDebug: JavaMail version 1.4.7 Testing . ^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.junkmail.com", port 25, isSSL false javax.mail.MessagingException: Could not connect to SMTP host: smtp.mail.com, po rt: 25; nested exception is: java.net.ConnectException: Connection timed out: connect at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:65 4) at javax.mail.Service.connect(Service.java:295) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at msgsend.main(msgsend.java:188)The output shows that:
2016-01-25, 1048👍, 0💬
Popular Posts:
What is jxl.jar 2.6.12? jxl.jar 2.6.12 is the JAR file for Java Excel API 2.6.12, which is a Java li...
ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify ex...
Smack is an Open Source XMPP (Jabber) client library for instant messaging and presence. A pure Java...
Java Servlet 2.4 Specification API. JAR File Size and Download Location: File name: servlet-api.jar,...
pache Derby is an open source relational database implemented entirely in Java and available under t...