email relay


You can’t setup reverse dns if you have dynamic IP address. This is common for residential internet. It was news to me. I searched though my registrar’s support documentation for an embarrassing amount of time. Turns out that the owner of the IP address, typically your isp or cloud provider, needs to set the ptr addreas. It is not set in your dns settings where you might expect them.

So I had a functioning email server that is close to being ready. What options did I have?

I could migrate the email server into the cloud. While this is what most people do in the first place, I think it has a lot of downsides. Any spammer can save an image of their email spamming setup and spin up new vms whenever they start getting blocked. The result is that many of the IP addresses that cloud providers have are "dirty." Put another way, setup your email server in the cloud and have fun trying to get your IP scrubbed from the blocklists. Your best bet is to try to find a cloud provider that advertises "clean" addresses.

The other downside of cloud, compared to a home server, is that your emails are now stored on another dude’s computer. Therefore they’ll be readable by that dude.

I ended up making a sort of comprimise. I decided to relay my email through sendgrid. This meant that the messages I recieve are kept locally on my own hard drives. I have to give up my sent emails to a spooky third party, but I think I can live with that. I mostly send emails to look for jobs. Occassionally I’ll send one asking a question.

It took me a few tries to figure it out but its relatively simple.

Here is something I didn’t see documented anywhere. I had to figure this out on my own. Using a delievery service like sendgrid only pertains to the sending of email. Therefore you only need to comment out lines that start with smtp.

sed -i s/smtp/#smtp/g /etc/postfix/main.cf

sed -i s/#smtpd/smtpd/g /etc/postfix/main.cf

smtp is responsible for sending email whereas smtpd is reponsible for recieving it. We want to comment it out to make room for the relay configuration.

sed -i s/relay/#relay/g /etc/postfix/main.cf

Also its important to only have one relayhost active in your configuration. If you do have it, its typically left blank. Its in the config by default From here I just followed the instructions from the docs for postfix. Just don’t forget to download the correct sasl package if you want to send. I wish email had better error messages when things aren’t working.