SMTP usage Examples:
/*
* New SendMail () Send text message using GBK's default encoding
* New SendMail (encoding, text or HTML);
*/
Wuyu.javamail.sendmail mail = new Wuyu.javamail.sendmail ("GBK", true);
/*
* Mail.connect (SMTP server);
* Main.connect (SMTP server, username, password); SMTP-authenticated sender server
*/
Mail.connect (Args[0], args[1], args[2]);
for (int i = 0; i < Integer.parseint (args[3]); i++) {
System.out.print (i + "t");
/*
* Main.send (FROM,TO,CC,BCC, subject, body, attachment file name)
* TO,CC,BCC can fill in multiple mail addresses
* The attachment file name is NULL, indicating that the attachment is not sent
*/
Mail.send ("mmwy@ynwst.com", Args[4], "", "", "This is the subject" + I, "<b> This is the body </b>", null);
System.out.println (i);
}
Mail.close ();
=-=--------------------
/**
* Call Java Mail class to send mail
*/
public class SendMail {
Private String encode;//Text encoding
Private Boolean html;//text or HTML content
Private Javax.mail.Session session;
Private Javax.mail.Transport transport;
Public SendMail () {
This.encode = "GBK";
This. HTML = false;
}
Public SendMail (String encode, Boolean html) {
This.encode = encode;
This. html = HTML;
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.