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");
Mail#1 From: [email protected] To: [email protected]
Mail#2 From: [email protected] To: [email protected]
...
Mails are triggered in a loop.
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.
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)
Thanks, Rana
Google announced on May 30, 2022, that all SMTP connections will no longer have access to their servers (even with less secure apps turned OFF) meaning any website contact form which was connected through an SMTP connection will simply not send contact forms any longer.
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.
First, check your message queue in G Suite admin area. If the queue is huge and still growing you send too fast.
Some useful links:
There is no further explanation what's wrong when you suffer from the error
421, "4.7.0", Try again later, closing connection.
General recommendations:
If pooling is used then Nodemailer keeps a fixed amount of connections open and sends the next message once a connection becomes available. It is most useful when you have a large number of messages that you want to send in batches or your provider allows you to only use a small amount of parallel connections.
Moral: If sending a large amount of email, it's probably best to use your own email server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With