I used to be a big fan of Mandrill. I used to use it as an email gateway for my personal servers. It’s easy to use and it’s cheap (Or free if you send less than 12,000 emails per month). I liked not having to setup SPF, DKIM, and DMARC for my small setups. Even for smaller clients I wouldn’t bother with that and just use Mandrill. Emails just show up with the following sender
This was convenient because destination mail servers would check Mandrill’s SPF and DKIM instead of checking the sender’s.
And then MailChimp decided to change their business model and Mandrill was no longer an option. I thought about checking other services like SparkPost or MailGun but then decided on building my own. You never know when they’d decide to do what MailChimp did.
Just add the following lines to main.cf (Those paths are for FreeBSD, your paths might vary)
sender_canonical_maps = regexp:/usr/local/etc/postfix/canonical sender_canonical_classes = envelope_sender header_checks = regexp:/usr/local/etc/postfix/my_custom_header
# /usr/local/etc/postfix/canonical /.*/ [email protected]
# /usr/local/etc/postfix/my_custom_header /^Subject:/i PREPEND Sender: [email protected]
What this does is add
[email protected] as the
Return-Path of all outgoing emails, and add a
Sender header to the message. You might want to tweak that logic a bit.