Configure connection_max_messages for SMTP connections?

ad682005

Member
Jan 8, 2018
14
2
3
India
cPanel Access Level
Website Owner
Hi,

I have to rate limit emails from my server such that no more than 20 messages are sent per SMTP connection (Reference - help.yahoo.com/kb/establish-proper-smtp-connections-sln3433.html

Search on internet resulted in finding that the parameter connection_max_messages needs to be configured in exim.conf file

Firstly I am not sure where in exim.conf this configuration needs to be set.

Some information that I figured out on internet suggests that it needs to be configured in the TRANSPORTSTART section as follows:
(Refer - How to Edit the exim.conf File - cPanel Knowledge Base - cPanel Documentation)

remote_smtp:
driver = smtp
connection_max_messages = 20
<... whatever else follows...>

dkim_remote_smtp:
driver = smtp
connection_max_messages = 20
<... whatever else follows...>

OK so I update the exim.conf file

But here is the thing - If I now go to Advanced Editor under Exim Configuration on WHM - I do not see the connection_max_messages that I have actually added in exim.conf vis SSH login.

WHM Advanced Editor does not allow that section to be edited

My questions:
a) Is connection_max_messages the right configuration for the Yahoo rate limit of messages per connection?

b) If no - then what is?

c) If yes, how do I change exim.conf? How do I ensure that WHM picks up the changes that I made directly to exim.conf?

d) What is the correct format of updating exim.conf.local? The cpanel documentation suggests that the local file must be updated as well. But the local file has a strange structure and I do not know how to do this.

Someone please help. There is not much information available on this.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
Hello,

I recommend first reverting any custom changes you made. Then, browse to "WHM Home » Service Configuration » Exim Configuration Manager » Advanced Editor" and scroll down until you see the "Add additional configuration setting" button. Click on this button, choose smtp_accept_max_per_connection from the drop-down box, and then enter "20" as the value. Finally, scroll to the very bottom of the interface and click on "Save". This should be the only change you need to make in order to follow the guideline referenced in the Yahoo URL you provided.

Thank you.
 

ad682005

Member
Jan 8, 2018
14
2
3
India
cPanel Access Level
Website Owner
Thanks for your reply.
I use a mass mailing system of acymailing.

If I use smtp_accept_max_per_connection =20, then I get an SMTP 421 error. Which means acymailing is not even able to submit the message to exim queue.

What I want is the acymailing continue to submit message to the exim queue & then when exim delivers the message - it should send no more than 20 in one SMTP connection. For sending more messages, EXIM to create more parallel connections that will send the messages over additional SMTP connections.

How do I do that?
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
Hello,

Here's Exim's description of the smtp_accept_max_per_connection option:

The value of this option limits the number of MAIL commands that Exim is prepared to accept over a single SMTP connection, whether or not each command results in the transfer of a message. After the limit is reached, a 421 response is given to subsequent MAIL commands. This limit is a safety precaution against a client that goes mad (incidents of this type have been seen).
It seems like you may want to adjust the smtp_accept_queue_per_connection option instead:

This option limits the number of delivery processes that Exim starts automatically when receiving messages via SMTP, whether via the daemon or by the use of -bs or -bS. If the value of the option is greater than zero, and the number of messages received in a single SMTP session exceeds this number, subsequent messages are placed on the queue, but no delivery processes are started. This helps to limit the number of Exim processes when a server restarts after downtime and there is a lot of mail waiting for it on other systems. On large systems, the default should probably be increased, and on dial-in client systems it should probably be set to zero (that is, disabled).
This option is found under "WHM Home » Service Configuration » Exim Configuration Manager » Advanced Editor" by default, so you can search for it and adjust it without using the "Add additional configuration setting" button.

Thank you.
 

ad682005

Member
Jan 8, 2018
14
2
3
India
cPanel Access Level
Website Owner
A Follow through on this to report the changes that I did, my findings & finally how the matter got resolved.

1) Removed the smtp_accept_max_per_connection configuration because that was giving errors even for submission of emails
2) Set smtp_accept_queue_per_connection = 20 (instead of default value = 30)
3) Set remote_max_parallel = 20 (instead of default value of 10)
4) Set queue_run_max = 50 (not set by default)

Even after these settings, yahoo kept reporting back temporarily deferred messages. The surprising thing was that my system had sent no more than 5 messages and yahoo would report this error and my emails to yahoo servers kept getting blocked. I had to submit a request to remove the block and then emails would get delivered.

NEXT STEP
1) Set connection_max_messages = 20 by directly updating exim.conf in the TRANSPORTSTART section
2) Changed retry configuration for recipient domain = yahoo.com, yahoo.co.in, yahoo.co.uk, yahoo.co.au similar to as shown below
yahoo.com mail_4xx F,4h,2h; G,2h,2h,1.5;
yahoo.com rcpt_4xx F,4h,2h; G,2h,2h,1.5;
This section change was done in the advanced editor of exim in cpanel

Even after these settings, yahoo kept reporting back temporarily deferred messages. The surprising thing was that my system had sent no more than 5 messages and yahoo would report this error and my emails to yahoo servers kept getting blocked. I had to submit a request to remove the block and then emails would get delivered.

After some time the service might have got restarted and hence the change that I had made directly in exim.conf (connection_max_messages = 20) was lost but the retry configuration changes made through the advanced editor was retained.

NEXT STEP (AFTER WHICH ISSUE HAS NOT OCCURRED)

I noticed that the messages that were getting blocked had a boxtrapper autowhitelist associated with it and for each message, there were 2 deliveries, 1 local to my server to report back to boxtrapper to autowhitelist & 1 to remote server. But the message was altered somehow and it had the boxtrapper autowhitelist notification against it.

I disabled boxtrapper for the sender email address.

After that my messages are getting delivered like a breeze to yahoo.

If need be I can simulate enabling boxtrapper & checking whether the issue reoccurs. My guess is that once boxtrapper takes over for the message being sent out, it somehow changes the headers and that results in yahoo considering the message as possibly fraudulent and hence blocks it even after 5 emails. But without boxtrapper, my email message is considered as authentic & it passes all the authentication requirements.

Hope this helps others.

I would appreciate if someone with more expertise than me can investigate this further & come up with best practices notification. I realize it is not directly related to cpanel but the community which uses cpanel will be eternally grateful to having a final resolution for this rampant email delivery issue to yahoo (many people have reported this with few solutions).

Thanks.