Configure Postfix to Work with MailGun
The content below may be out-of-date or otherwise superseded by another post.
MailGun is a relatively new online service that allows us to cheaply (and freely) send and receive emails through dozens of different ways. MailGun is incredibly flexible with an API for developers crafted in programming heaven.
I sought MailGun after I learned of the pain of setting up and maintaining a mail servers. Hours waiting for MX, SPF, and PTR records to propagate; hours testing DKIM keys and routing; and hours still setting up a gateway for secure connections with the mail server. I was ecstatic when I found MailGun does all of this for us developers (not to forget that MailGun gives us 10,000 emails a month, too).
After I integrated MailGun into my programs and web apps I realised there were so many other uses. Why not use MailGun on all of my production servers (the ones that aren't mail servers)? So I quickly put together a script and deployed MailGun to my servers.
Below is the script:
You need to make sure to create some mail gun credentials and edit the
Also ensure that
testEmail is correct. This email will be used to test the postfix configurations. The next step is to simply run the script:
bash ./mg-postfix.sh and you're done!