How should I implement an email circuit test

emailmonitoringzabbix

I want a high-level test that ensures that both incoming and outgoing email services are operating normally. I've achieved this by writing a python script which does this:

  1. Send a message with a unique hash through my mail server to foo-circuit-test@gmail.com
  2. The gmail account is configured to auto-reply back to the same address and then delete the message.
  3. My script polls IMAP until it finds an email with the correct hash sitting in its inbox, or times out.
  4. It reports the elapsed time to my monitoring software (Zabbix)

My question: Is gmail the best third-party to use? Should I add a couple others as well such as hotmail and yahoo? Is there anyone more official that will auto-reply to these sorts of "mail pings"? Any other recommendations for this type of test?

Best Answer

I had something similar but got frustrated with false positives (any of the free email services is going to be decent about mail delivery but there were occasional delays with Gmail). I ended up splitting this into two monitors: one to send an email to my server via SMTP and then check the mailbox via IMAP to make sure it arrived (that covers inbound) and the other just watches the outbound mail queue and alerts if it gets above x messages. Assuming your server is loaded 24x7, the outbound queue will fill if outbound delivery isn't working.

Related Topic