2
回答
454 Throttling failure: Maximum sending rate exceeded.
终于搞明白,存储TCO原来是这样算的>>>   

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);

}

}

大家帮忙看下。

举报
samba
发帖于5年前 2回/170阅
顶部