Author: Volker Schmelich Date: To: exim-users Subject: [exim] Scheduling / Delaying of messages with Exim possible?
Dear list members,
I have to schedule emails to be sent at a specific date/time in the
future. For example, 100 emails with about 1 MB in size each will have
to be sent at midnight on a specific day. The first attempt to send the
email must be within one minute after the scheduled time. I know that
delivery itself can not be guaranteed.
My existing solution basically consists of a custom-developed
rudimentary SMTP server which parses incoming emails for a specific
header (e.g. X-Scheduled-For: 2010-08-19 08:57:00 GMT), then saves the
email to the filesystem and creates a record in a database. A cron job
runs every minute and determines which emails need to be sent. For each
email, a process is created which reads the email file from filesystem,
connects to local Exim on port 25 and delivers the email.
The system generating each email in the first place has not enough
upload bandwidth so all emails have to be on the Exim server before the
scheduled date/time is reached to avoid delays. That's why I have the
custom-developed SMTP in place.
The problem is that with 100 or more emails the processes eat up all of
the 1.7GB RAM the current server has and Exim cannot fork enough
processes to receive/send the messages. So it would be great to have
these emails already in the mail server and the mail server does the
scheduling itself.
I wonder if there are any out-of-the-box configuration options or rules
available to accomplish scheduling/delaying of messages in Exim. Or if
there is any script or ready-to-use program on top of Exim which can
provide this functionality.
My ideal workflow would be:
1) External system generates emails with a specific header (e.g.
X-Scheduled-For: 2010-08-19 08:57:00 GMT) and connects to Exim 10 hours
before the scheduled date/time.
2) Exim parses all received mails for the X-Scheduled-For header. Emails
with a scheduled date in the future are kept in a queue and are released
when the specified date/time is reached. Other emails are sent
immediately.
Is it possible to accomplish this by configuration?
Any ideas how to do this in a resource-friendly way?
Ideas, comments and suggestions are much appreciated.