gpt4 book ai didi

超过客户端的 Javamail 速率

转载 作者:行者123 更新时间:2023-11-30 07:10:32 30 4
gpt4 key购买 nike

我需要一次发送至少 200 条消息。程序启动后,给15或17发邮件成功,然后报错:

消息错误:

com.sun.mail.smtp.SMTPSendFailedException: 421 4.4.2 Message submission rate for this client has exceeded the configured limit

我能做什么?

Java 代码

public void mandarEmail(String correos, String mensaje, String asunto) {
Message message;
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.transport.protocol", "smtp");
props.setProperty("mail.smtp.port", "587");
props.put("mail.smtp.host", "pod51004.outlook.com");
props.put("mail.smtp.debug", "true");

Session session = Session.getInstance(props, new javax.mail.Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("docemail@usmp.pe", "docpass");
}
});

try {
message = new MimeMessage(session);
message.setFrom(new InternetAddress("USMP - FN <documentos-fn@usmp.pe>"));
message.setSubject(asunto);
message.addRecipients(Message.RecipientType.TO, InternetAddress.parse(correos));
message.addRecipients(Message.RecipientType.BCC, new InternetAddress[]{new InternetAddress("ivan_pro_nice@hotmail.com")});
message.setContent(mensaje, "text/html; charset=utf-8");
Transport transport = session.getTransport("smtp");
transport.connect("docemail@usmp.pe", "docpass");
transport.sendMessage(message, message.getAllRecipients());
transport.close();
} catch (MessagingException e) {
throw new RuntimeException(e);
} finally {
props = null;
message = null;
}
}

最佳答案

那是您要连接的服务器,不是客户端问题。 Here's a doc关于如何解析来自服务器的 SMTP 代码。

A mail server will reply to every request a client (such as your email program) makes with a return code. This code consists of three numbers.

在您的例子中,您得到的是 421

关于超过客户端的 Javamail 速率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22154327/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com