Those experiencing this problem when trying to send batches of emails through the google’s multiple MX records (aspmx.l.google.com , alt1.aspmx.l.google.com , …) , here are some workarounds.
In this case scenario we will assume we are using CentOS and sendmail as our method.
- Segregate different domain emails to be sent through a separate sendmail session (this is usually done in your code)
- Relay everything through the smtp.gmail.com
- Configure sendmail to delivery to each email on one connection.
On you sendmail.mc add these following line
define(`SMTP_MAILER_MAXRCPTS', `1')dnl define(`RELAY_MAILER_MAXRCPTS', `1')dnl
The above lines MUST be added before
After that save your .mc and m4 it to your .cf
m4 sendmail.mc > sendmail.cf
Restart sendmail and test
service sendmail restart
If, however, you are those that directly edit the .cf instead of the .mc then you’ll have to do the following
In you .cf find the following text (“Msmtp,” , “Mesmtp,” , “Mdsmtp, “, “Mrelay,”)
After that find the following line(s)
And change it to look like this
This problem isn’t really an error as it requques your emails when this happens.
Though the third solution will work is not ideal to use as it requires sendmail to open/close connections for each email.
One last thing to look for is the cached-connections for sendmail