For months I have been trying to figure out a way to monitor email flow for my customers. Not just to monitor whether services are running or servers and internet up but actually confirm that emails are flowing in and out correctly.
Recently I found a great third party tool which can be incorporated into your Kaseya alerts which will send and rewceive test emails and then validate that they have reached their destination. If not it raises an alert.
Check out www.mailflowmonitor.com.au
I have written a powershell script specifically for monitoring our mail server, but I am expanding to monitoring customer's email servers.
I can't release it to the public, but here's a hint at how I did it:
1. Do an MX record lookup via DNS and sort the MX servers by priority.
2. Send an email directly to the first MX record. If it fails, go to the 2nd and 3rd. You should use a unique random string in the subject line.
3. Use POP or IMAP to pull a mailbox listing to see if the subject can be found.
In my script, I try the POP server 5 times, waiting 2, 4, 9, 16 and 25 seconds before subsequent attempts.
If it fails and cannot find the email with the unique subject, have it send an email directly to an outside provider (gmail in this case). Hopefully you can authenticate so you know your mail will not get stuck.
Remember: Don't use your own mail server to send out the alerts. If your server is down, you'll never know!!
Wouldn't want to use this forum to publicize anything. However if your still interested in this i build a useful tool for monitoring mail flow. Take a look at mxalerts.com
Here is an example how you can monitor e-mail flow with KNM
We never open POP/IMAP to the outside world for our Exchange servers, that's what RPC over HTTP is for. Having POP/IMAP open to Exchange is just one, or two, more open attack vectors.
Can KNM or another end-to-end mail transport monitor work with RPC over HTTP for Exchange?