批量电子邮件失败

批量电子邮件失败

本文介绍了批量电子邮件失败,出现 421 4.7.0 稍后再试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的组织中发送批量电子邮件.我是 Java Mail API 并使用以下配置发送邮件.

I have a requirement to send bulk emails with in my organization. I am Java Mail API and sending the mails with below config.

        props.put("mail.transport.protocol", "smtp");
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.host", "smtp.gmail.com");
        props.put("mail.smtp.port", "587");

邮件#1发件人:[email protected]致:[email protected]

Mail#1From: [email protected]: [email protected]

邮件#2发件人:[email protected]致:[email protected]

Mail#2From: [email protected]: [email protected]

...

邮件在循环中触发.

问题:前 80 封电子邮件已成功发送.从第 81 封邮件开始,我在 10-15 封电子邮件中出现以下错误,后来成功发送了几封邮件.

Problem:First 80 emails sent successfully. From 81st mail I am failing with below error for 10-15 emails and later few mails are sent successfully.

在 743 封电子邮件中有 400 封失败和343是成功的.

Out of 743 emails 400 Failed & 343 are success.

    INFO   | jvm 1    | 2017/08/18 07:25:54 | com.sun.mail.smtp.SMTPSendFailedException: 421 4.7.0 Try again later, closing connection. (MAIL) xsdsfasdsa.96 - gsmtp
    INFO   | jvm 1    | 2017/08/18 07:25:54 |
    INFO   | jvm 1    | 2017/08/18 07:25:54 |   at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2108)
    INFO   | jvm 1    | 2017/08/18 07:25:54 |   at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1609)
    INFO   | jvm 1    | 2017/08/18 07:25:54 |   at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1117)
  1. 帮我解决一下.
  2. smtp.gmail.com 上是否有任何特定的每分钟限制?

谢谢,林蛙

推荐答案

是的,我认为通过 Gmail 发送 SMPT 消息有每分钟的限制(根据我的经验,在 80-100).但这不是 100% 的硬限制,而是在 Gmail 认为到期时强制执行的某种软限制.

Yes, I think there is a per minute limit for sending SMPT messages via Gmail (around 80 in my experience that of others around 80-100). But it's not a 100% hard limit but some sort of soft limit that is enforced when Gmail thinks its due.

首先,在 G Suite 管理区域检查您的消息队列.如果队列很大并且还在增长,那么您发送的速度太快了.

First, check your message queue in G Suite admin area. If the queue is huge and still growing you send too fast.

一些有用的链接:

当你遇到错误时,没有进一步的解释是什么问题

There is no further explanation what's wrong when you suffer from the error

421, "4.7.0", 稍后再试,关闭连接.

一般建议:

如果使用池化,那么 Nodemailer 会保持固定数量的连接打开并在连接可用时发送下一条消息.当您有大量消息时,它最有用想要分批发送,或者您的提供商只允许您使用少量并行连接.

  • 不要发送太快
  • 一次发送的电子邮件不要超过 50 封
  • 不要假设 Gmail 是本地系统.这是一项外部服务,它使用复杂的方法使电子邮件在全球范围内可用,扩展了一项具有 42 年历史的远非完美的发明.
  • 不要尝试愚蠢的事情,否则 Gmail 会惩罚你.
  • 道德:如果发送大量电子邮件,最好使用自己的电子邮件服务器.

    Moral: If sending a large amount of email, it's probably best to use your own email server.

    这篇关于批量电子邮件失败,出现 421 4.7.0 稍后再试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 01:35