Use JavaMail to send mail, in the use of 163 of mailboxes to send mail to other mailboxes, reported the following error, according to the prompts to view NetEase mailbox back to the common problems, see return code 554 corresponds to the "Sent message content contains unauthorized information, or is recognized as spam by the system." Please check if there is a user sending a virus or spam "this error."
Javax.mail.SendFailedException:Sending failed; Nested exception is:
Class javax.mail.messagingexception:554 DT:SPM 163 smtp9,dccowadnv1gyabnzzl4fdw--. 19713s2 1494417432,please-http ://mail.163.com/help/help_spam_16.htm?ip=112.2.4.140&hostid=smtp9&time=1494417432
At Javax.mail.Transport.send0 (transport.java:218)
At Javax.mail.Transport.send (transport.java:80)
at email. Mainutil.sendmail (mainutil.java:69)
at email. Mainutil.main (mainutil.java:73)
But sent to their own mailbox can be sent, online search data said configuration information is incomplete, according to the information above the prompts to add code
Set transport protocol
Props.setproperty ("Mail.transport.protocol", "SMTP");
Easy to debug
Props.put ("Mail.debug", "true");
After you joined the debug configuration, the print log reported the following error
Debug:java.io.filenotfoundexception:d:\program Files (x86) \java\jdk1.7.0_01\jre\lib\javamail.providers ( The system could not find the specified file. )
But the web says the configuration file is loaded in the following order
The session is loaded in the following order of precedence in the configuration file:
1 First use the javamail.providers in <java_home>/lib;
2) If 1 does not exist the corresponding configuration file, using the classpath under the Mail.jar meta-inf directory javamail.providers;
3) If 2 does not exist the corresponding configuration file, the use of Mail.jar in the classpath under the Meta-inf directory of Javamail.default.providers;
So developers can provide configuration files in the <java_home>/lib directory to cover the configuration of vendors in the Mail.jar/meta-inf directory. However, in general, we do not need to do so. Reference Link: http://blog.csdn.net/cyzero/article/details/27087685
And the log also debug:successfully loaded resource:/meta-inf/javamail.default.providers
It doesn't seem to be the reason continue to check the data found in the host to set up the time when a word SMTP, previously written is Mail.host, the following is the correct wording, modified to send the normal mail, the specific reasons I do not know, I am also a rookie (please pass under the guidance of the Great God ^_^)
Props.setproperty ("Mail.smtp.host", "smtp.163.com");