Summary: A PHP class exists to manipulate POP3 servers. It can be used to write an entire webmail application, but I’ve used only a subset of its capabilities to implement an end-to-end email monitoring system.
I recently wrote about using a script from Alertra to monitor email delivery. It seems that I didn’t look at the script closely enough. This became obvious when I sat down to implement what I thought was a BASH script and it wasn’t. Investigation (meaning, I read the page the script came from) revealed that it was written in the Alertra Script Language. Shrug…like we need that.
I then went on a hunt for an existing PHP solution and was pleased to find Manuel Lemos’ PHP class.
I wanted to be assured that the entire email system on a server is working properly. The only way to do that well is to send an email to an account on that server and then check if it arrived. I have stripped down Manuel’s test page to simpy ensure that there is more than one message in the test account and then I added some code in the beginning to send an email to it in the first place.
The server the class is being hosted on uses PHP’s mail() function to send an email to my test account on the server that I want to monitor. The script then sleeps for a minute to allow the email to pass through all of the spam and antivirus checks on the monitored server, and then logs in to the account to see if it has been delivered. If it has, it deletes it. If it hasn’t, it uses PHP’s mail function to send me an alert email. All in all it is very simple and fairly reliable. There are some caveats, but we have some fairly rigorous monitoring on this server already so the sum of the parts makes a pretty good whole.
I can’t share the actual code at this point because I didn’t fund its mods, but Manuel’s class is very well written and easy to understand.
Tags: email, monitoring, php
October 22, 2008
Bummer, comments are closed.