Use Postfix for Outgoing Email Only
These days, most of my hair-brained schemes result in pulling up a small instance at <insert your favorite cloud provider here>. Inevitably, there are certain tasks that I find myself repeating over and over again -- most of you are probably yelling at me to use Puppet or Chef, but that's for another blog post. Anyway, one thing I inevitably look up every time is how to configure Postfix for outgoing email only; after all, how else are all those "Thank you for signing up with..." going to get sent to the masses? To save myself (and maybe the next person) a few minutes of Googling (errr, Binging... yeah right, Microsoft), here are the basics:
1) Edit your /etc/postfix/main.cf to look like this. Make sure that myhostname is different from mydomain:
mydomain = domain.com
myhostname = host.domain.com
myorigin = $mydomain
relayhost = $mydomain
inet_interfaces = loopback-only
local_transport = error:local delivery is disabled
2) And comment out the local entry in your /etc/postfix/master.cf like this:
...
retry unix - - - - - error
discard unix - - - - - discard
#local unix - n n - - local
...
That's it! Keep in mind that such a simple setup is fine for getting the ball rolling on your next big idea, but you will need to take extra steps for any production-ready system (especially to avoid getting flagged as spam).

