org.apache.commons.mail.EmailException: Sending the email to the following server failed : www.*.com:25at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)at org.apache.commons.mail.Email.send(Email.java:1496)Cau
org.apache.commons.mail.EmailException: Sending the email to the following server failed : www.*.com:25at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)at org.apache.commons.mail.Email.send(Email.java:1496)Caused by: javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 554 RCPT (l1@126.com) dosn't exist; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 554 RCPT (l1@126.com) dosn't exist at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1294) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:635) at javax.mail.Transport.send0(Transport.java:189) at javax.mail.Transport.send(Transport.java:118) at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459) ... 34 moreCaused by: com.sun.mail.smtp.SMTPAddressFailedException: 554 RCPT (l2@126.com) dosn't exist; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 554 RCPT (l2@126.com) dosn't exist at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1192) ... 38 moreCaused by: com.sun.mail.smtp.SMTPAddressFailedException: 554 RCPT (luo1@goodbaby.com) dosn't exist ... 39 more
解决方案} catch (MalformedURLException | EmailException | UnsupportedEncodingException e) { Throwable cause = e.getCause(); Address[] invalidAddresses = ((SendFailedException) cause).getInvalidAddresses(); 结果是:l1@126.com,l2@126.com 查出来后在程序中替换