当前位置 : 主页 > 编程语言 > java >

java 邮件多个发送人出现收件人不存在

来源:互联网 收集:自由互联 发布时间:2023-02-04
org.apache.commons.mail.EmailException: Sending the email to the following server failed : www.*​​.com:25​​​at 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:25​​​at 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 查出来后在程序中替换
上一篇:什么是跨站请求伪造CSRF
下一篇:没有了
网友评论