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