Wednesday, January 25, 2006

Detecting email problems

This is just a little tip for detecting email issues with your web
hosting provider. Myself and some friends of mine were experiencing
email loss with our hosting provider. So, in order to provide some
imperial data we set up a couple of automated processes to send
ourselves email every 5 minutes. We set up one process on the
provider's server which sent to an email account in question on the
provider's server, as well as an external control account. Then we set
up another process on another server outside of the hosting provider's
realm to send email to the same email account in question on the hosting
provider and the control account. The external email account was our
control set to monitor that all the email messages were actually

The setup (done on both the hosted server and the secondary server):

Make a test message such as:

Subject: 5min Test from [servername]
From: Automated Test <>

Test email.

The header information in the test message is useful for adding filters
to your email client. The blank line is necessary after the header
lines in order for sendmail to recognize it as a header.

We then set up a simple cron process

*/5 * * * * /usr/sbin/sendmail -i, < testemail.txt

This will send out the message every 5 minutes (every minute divisible
by 5). Then it is just a matter of scanning the email received for
missing emails.
In the end, we were able to detect email loss as well as delayed email.
The hosting provider was then able to make some adjustments to stop the
loss. During peek load times, some email still gets lost for a hour or
two, but does eventually show up.

No comments: