Java Mail Send test

Source: Internet
Author: User

Using the encapsulated Mailutils tool, do the Send mail test:

1/*2* Test Mailutils3* The underlying dependency is Javamail:activation.jar,mail.jar4*/5PublicClassmailutilstest {6@Test7PublicvoidSend () throws Messagingexception, ioexception{8 Session createsession = Mailutils.createsession ("Smtp.163.com","[Email protected]","13866817259yt"); 9 Mail mail = new mail ("[email protected]", "[email protected]", " test message a letter " , "<a href= ' http://www.baidu.com ' > Baidu </a>");  Ten mailutils.send (createsession, mail);  One }                

The following error occurred

1 javax.mail.AuthenticationFailedException:failed to connect

Cause of Error:

You need to turn on the mailbox client authorization password, which is the private password for the third-party mail client.

Applies to log in to the following services: Pop3/imap/smtp/exchange/carddav/caldav service.

Java Mail Send test

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.