A lot of the systems I build require alerting of some kind (if exceptions occur, services go down etc.)  Because it can sometimes be a pain with deliverability (wrangling sendmail on different servers, dealing with getting marked as spam etc.)  I always use a service like mailgun along with a quick function to never have to worry about my alerts not going through.

Sign up for a Mailgun Account

Mailgun offers a great deal (10k messages/month are free)  so if you are only sending occasional alerts as a developer you get enterprise level service for free.

Hook up a domain to Mailgun

You could use their sandbox domains but I’ve always found it best just to use one my domains as it reduces risk of any deliverability issues.

After you setup a domain and verify it, they will give you an API key that you can now use to make calls.

Simple Python Requests Function For Sending Mail

Mailgun does have ‘custom’ packages for different languages, but it’s so easy to use their REST api that it’s not worth messing with them.  Check out this quick function:  You can send to multiple addresses, send HTML etc. without any further configuration.


Happy emailing 🙂