Complete code instance for users who send mail to 163.com in JavaMail-free authentication Mode

Source: Internet
Author: User
Java code:
---------------------------------------------------------------------------------------
Package Com.lizongbo;
Import java.util.*;
Import javax.mail.internet.*;
Import javax.mail.*;
/**
* <p>title:javamail to 163 </p>
*
* <p>description: Send mail to 163.com users with JavaMail-free authentication method,
* The specific principle is not explained in detail, interested persons please check the relevant information.
*/p>
*
* <p>copyright:copyright (c) 2005</p>
*
* <p>company:lizongbo </p>
*
* @author Lizongbo Http://www.donews.net/lizongbo
* @version 1.0
*/
public class JavaMail163 {
public static void Main (string[] args) throws Addressexception,
messagingexception {
Properties Mailpro = new properties ();
Mailpro.setproperty ("Mail.smtp.host", "202.108.44.210");
Session session = Session.getdefaultinstance (Mailpro);
Session.setdebug (TRUE);
MimeMessage msg = new MimeMessage (session);
Msg.setfrom (New InternetAddress ("lizongbo@gmail.com"));
Msg.setrecipient (Message.RecipientType.TO,
New InternetAddress ("li_zongbo@163.com"));
Msg.setsubject ("Test-free way to send mail!!! ");
Msg.settext ("Test, mail from Http://www.donews.net/lizongbo");
Transport.send (msg);
}
}
---------------------------------------------------------------------------------------
Execution results:
---------------------------------------------------------------------------------------
Debug:getprovider () returning Javax.mail.provider[transport,smtp,com.sun.mail.smtp.smtptransport,sun Microsystems , INC]
DEBUG Smtp:useehlo true, Useauth false
Debug:smtptransport trying to connect to host "202.108.44.210", port 25
DEBUG SMTP rcvd:220 coremail smtp (Anti Spam) System (163com[20050206))

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.