Default Outbound Connection Handling Logic For Sendmail
An interesting question came up the other day (of which I’m paraphrasing):
In the event that Sendmail has multiple “first-time” outbound emails to deliver at once and a single downstream smarthost is defined, how does it handle outbound connections? Does it send everything in single file?
Initially, I thought that delivery would be handled in a serial fashion to save on time spent establishing (and tearing down) connections. After testing and researching a bit more though, that’s not quite right.
While it’s true that Sendmail has some connection caching features (like
ConnectionCacheTimeout params), that’s not really involved in first-time delivery of messages.
By default, Sendmail uses a delivery mode called
background. More information is available in section 24.9.35 of the famous Sendmail bat book (web excerpt available here). This mode allows Sendmail to fork another process for delivery after accepting any message. So in short, Sendmail uses multiple threads (which is good news for folks with a lot of email to send through it).
On a side note, there are several different tweaks and options available (like
confHOST_STATUS_DIRECTORY) but there’s usually no compelling reason to add/change those since it would introduce an artificial bottleneck.
Credit to SendMail genius Andrzej A. Filip for the details.