Uberzen1
Uberzen1

Reputation: 415

Monitoring Email Service

I am in the process of adding 'heart-beat' monitoring to all of the key points of our system. One of these is an email service that basically sends out reports on a schedule over smtp. I figure I can monitor if this is working by setting up a schedule to send an email to a central 'monitoring' inbox, and if it's not received then it is of course, not working.

How could I possibly monitor this inbox for these emails programmatically? I have read a few posts about using powershell to access an exchange server, but we do not use exchange internally, we are just using gmail. Is there a way I could just send the message to an 'endpoint' or some sort of listener on a server?

Any ideas greatly appreciated,

Thanks,

Upvotes: 1

Views: 236

Answers (2)

Mark
Mark

Reputation: 31

Simplest way would be to use some monitoring tool which periodically checks connection to your email service. I believe Pingdom and AppBeat allow you this. Would online solution be good for you or do you want internal monitor?

Upvotes: 1

emjay
emjay

Reputation: 440

You can use python to set up a simple SMTP server that instead of sending emails, writes the contents on the console:

python -m smtpd -n -c DebuggingServer localhost:1025

Or run the command with its output redirected to a file:

python -m smtpd -n -c DebuggingServer localhost:1025 > output.txt

Then you can instruct your service to send emails to this service (localhost, port 1025) and then check its console or output file.

This will of course monitor the correct behavior of your program, but not whether the email is actually sent or not. But, as you're using gmail, then probably you can be confident of that! You may only need to monitor the connection to gmail's SMTP server which is a simple telnet.

Upvotes: 1

Related Questions