4

How can I force postfix to send out mails sequentially and not simultaneously? It should open only one SMTP connection at a time.

It should only affect outgoing SMTP connections. Incoming connections can still be handled simultaneously.


Why?

My VPS Provider (contabo.de) had the very funny Idea to tie the hands of spammers by limiting the number of simultaneous SMTP connections to 1. I'm not sending SPAM, but a script is sending important order mails to 3 recipients at the same time once a day. This is then blocked with Connection refused in postfix and the mails are deferred. Sometimes it takes over two hours to send the mails out, because at every try the simultaneous connections are blocked.

Stefan Profanter
  • 365
  • 1
  • 5
  • 17
  • 3
    Switch VPS providers if they can't deliver the service you need. Or set up your own mailrelay elsewhere to use (where you can circumvent the concurrency limit on port 25 by using a different port or a VPN to route messages from your current VPS ) or subscribe to a transactional mailservice that also doesn't require port 25. – HBruijn Sep 02 '16 at 21:03
  • 4
    But you can limit the `maxproc` setting in your postfix master.cf to limit the concurrency of a number of postfix services – HBruijn Sep 02 '16 at 21:05

1 Answers1

2

Steal Expand awesome comment from HBruijn to not-so-awesome answer

Snippet from postfix docs:

The default_process_limit configuration parameter gives direct control over how many daemon processes Postfix will run. As of Postfix 2.0 the default limit is 100 SMTP client processes, 100 SMTP server processes, and so on. This may overwhelm systems with little memory, as well as networks with low bandwidth.

....snip....

You can override the process limit for specific Postfix daemons by editing the master.cf file.

One reason why postfix can deliver simultaneously is because it has smtp delivery services ready in charge. So if you want to limit it, reduce the value on maxproc column on smtp service in postfix so the only one smtp delivery service works in the same time.

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (no)    (never) (100)
# ==========================================================================
...
smtp      unix  -       -       n       -       1       smtp
relay     unix  -       -       n       -       1       smtp
masegaloeh
  • 18,236
  • 10
  • 57
  • 106