454 Throttling failure: Maximum sending rate exceeded.
com.sun.mail.smtp.SMTPSendFailedException: 454 Throttling failure: Maximum sending rate exceeded.
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1215)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:586)
at com.amazon.ses.SendMessageRunnable.startSendEmail(SendMessageRunnable.java:122)
at com.amazon.ses.SendMessageRunnable.run(SendMessageRunnable.java:58)
at java.lang.Thread.run(Thread.java:722)
代码如下:我在发送email 的时候加入了多线程。可能是500封,也可能是1000封。或2000 - 4000.
transport = session.getTransport("smtp");
transport.connect("email-smtp.us-east-1.amazonaws.com", UserInformation.emailUser, UserInformation.emailPassword);
for (SObject contact : result.getContacts()) {
if (contact.getField("Email") != null) {
if (!transport.isConnected()) {
transport.connect("email-smtp.us-east-1.amazonaws.com", UserInformation.emailUser, UserInformation.emailPassword);
}
Thread thread = new Thread(new SendMessageRunnable(tasks,
transport, sender, emailTemplate,
contact, attachments, documents));
flag = true;
thread.start();
listThread.add(thread);
}
}
大家帮忙看下。如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我在下一个线程启动之前 sleep(1000); 这样这个问题能解决吗?
服务器限制了你的发送频率,发太狠了