Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?
share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
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. –  Richard Keller May 2 '11 at 22:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.