2

I have a fairly standard Exim setup for inbound and outbound mail. Recently our development team has put together a PHP app that allows us to send out bulk mails to our clients. The PHP app uses standard PEAR libraries to initiate an SMTP connection to localhost (application and mail server are on the same box). The idea here is that the application will send out roughly 10'000 emails in a very short time period (60 seconds or so) which Exim will then hold in its queue for delivery.

The problem comes in where after about 50 emails, Exim stops accepting mail and loggs the following error in the exim_main.log file:

SMTP command timeout on connection from localhost [127.0.0.1]

Could it be that this is because Exim immediately starts delivering the mail and then stops accepting new incoming connections? I thought that increasing the SMTP limits may be the problem here, but even after setting new values in the exim.conf file to the following, I still get the same problem:

queue_run_max = 5000
smtp_accept_max = 5000
smtp_accept_queue = 5000

This begs two questions:

  1. How do I resolve this?
  2. What is the best way for configuring Exim to accept a huge amount of mail into the queue in a very short time period, but then gradually delivery it once it's all in the queue? I've seen some people run separate Exim daemons for incoming and outgoing mail; is this a good solution?

1 Answer 1

4

By default exim attempts to deliver an email immediately it arrives to try and avoid queueing it.

If it can't deliver it immediately it enters the spool directory.

By default all these message files are held in a single directory called input inside the general Exim spool directory. Some operating systems do not perform very well if the number of files in a directory gets large; to improve performance in such cases, the split_spool_directory option can be used. This causes Exim to split up the input files into 62 sub-directories whose names are single letters or digits. When this is done, the queue is processed one sub-directory at a time instead of all at once, which can improve overall performance even when there are not enough files in each directory to affect file system performance.

There are options that control whether Exim will try its immediate delivery or not:

  • queue_only_load - queue incoming if load high
  • queue_only_load_latch - don’t re-evaluate load for each message
  • queue_run_max - maximum simultaneous queue runners

and, most importantly:

  • queue_only - no immediate delivery at all

All these settings are detailed in the Exim Specification Manual

4
  • The problem was actually an issue with the PEAR library I was using. Open sockets were not being closed correctly, and as a result each socket stayed open until Exim timed out the connection and closed the socket forcefully. Your reply, although not the actual solution, was still very useful in resolving the problem. May 2, 2011 at 22:27
  • I understood queue_only function and I wish to enable it, but in which part of the config file should I add it to? also, I wanna know where do I set how often queue runner runs, it has been mentioned in the documentation but doesn't tell how. e.g. every minute
    – Luka
    Jan 16, 2018 at 18:09
  • It goes in the "main" configuration section - the bit at the top that's not a router, etc.
    – Majenko
    Jan 16, 2018 at 18:32
  • The queue runner is either run manually (exim -q) or you can specify the period when run as a daemon (exim -bd -q30m for 30 minute intervals, for example).
    – Majenko
    Jan 16, 2018 at 18:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .