我在使用Java Mail发送邮件时遇到以下错误。下面是错误。你能告诉我错误的原因吗?
ERROR :: Sending failed;
nested exception is:
class javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
class javax.mail.SendFailedException: 452 Too many recipients received this hour
;
nested exception is:
class javax.mail.SendFailedException: 452 Too many recipients received this hour
;
nested exception is:
class javax.mail.SendFailedException: 452 Too many recipients received this hour
;
nested exception is:
class javax.mail.SendFailedException: 452 Too many recipients received this hour
;
nested exception is:
class javax.mail.SendFailedException: 452 Too many recipients received this hour
;
nested exception is:
class javax.mail.SendFailedException: 452 Too many recipients received this hour
;
nested exception is:
class javax.mail.SendFailedException: 452 Too many recipients received this hour下面是导致异常的方法。
公共空sendTextReport(DataBean dataBean,TextBean textBean)抛出IOException,MessagingException {
Session session = getAuthentication();
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(this.props.getProperty("from")));
message.addRecipients(Message.RecipientType.TO,InternetAddress.parse(this.props.getProperty("textTo")));
message.addRecipients(Message.RecipientType.CC,InternetAddress.parse(this.props.getProperty("textCc")));
message.setSubject(" Report for the submissions between "+ dates.getDate1() + " and " + dates.getDate2());
StringBuilder mailBody = new StringBuilder();
mailBody.append("<text>Hi All,<br><br>Below is the Report for the submissions </text><br><br><br>");
mailBody.append("<table><tr><th>Description</th><th>Count</th></tr>");
LinkedHashMap map=(LinkedHashMap) getTextMap(dataBean,textBean);
Iterator it=map.entrySet().iterator();
while(it.hasNext()){
Entry<String, Integer> entry=(Entry) it.next();
mailBody.append("<tr><td>"+entry.getKey()+"</th><td class='count'>"+entry.getValue()+"</td></tr>");
}
BodyPart messageBodyPart1 = new MimeBodyPart();
messageBodyPart1.setContent(mailBody.toString(), "text/html");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart1);
message.setContent(multipart);
Transport.send(message);}
public Session getAuthentication() {
final String host = this.props.getProperty("from");
final String password = this.props.getProperty("password");
properties.setProperty("mail.smtp.host", this.props.getProperty("hostName"));
Session session = Session.getInstance(properties,null);
return session;}
textTo:该字符串包含3个电子邮件地址textCc:该字符串包含1个通讯组列表,该列表包含8个电子邮件地址。
所有这些都是有效的电子邮件地址。我检查了SendFailedException.Seems中的getValidUnsentAddresses(),所有这些都是有效的,但没有发送出去。
发布于 2015-06-30 17:04:28
这就是所谓的灰色列表。当您发送太多电子邮件(或者更常见的情况是,在收件人不存在的情况下,发送了一定数量的电子邮件),目标邮件服务器不会将您列入黑名单,而是会暂时阻止从您的邮件服务器(本质上是您的邮件服务器的IP地址)进行访问。通常此块设置为1小时,但显然可以根据配置的不同而有所不同。
您可以做以下几件事:
1.联系相关域名的管理员(例如postmaster@messaging.sprintpcs.com),请求将您的IP地址列入白名单。(他们可以拒绝)。
2.检查/增加电子邮件在本地队列中的停留时间(以获得更多重试并最终送达的机会。
3.向您的服务器添加更多公有IP地址
https://stackoverflow.com/questions/31133590
复制相似问题