Programming Tech Brief By HackerNoon

← Programming Tech Brief By HackerNooneergisteren · 20 min

I Built a Mail Server From Scratch and Spent Most of My Time on Four DNS Records

I Built a Mail Server From Scratch and Spent Most of My Time on Four DNS Recordseergisteren20 min

This story was originally published on HackerNoon at: https://hackernoon.com/i-built-a-mail-server-from-scratch-and-spent-most-of-my-time-on-four-dns-records.

Build a mail server from a bare VPS with CyberPanel, then get it to 10/10 on mail-tester: PTR, SPF, DKIM, DMARC, and the OpenDKIM milter trap.

Check more stories related to programming at: https://hackernoon.com/c/programming.

You can also check exclusive content about #postfix, #email-deliverability, #dkim, #devops, #spf, #server-management, #vps, #linux, and more.

This story was written by: @obaid03. Learn more about this writer by checking @obaid03's about page,

and for more stories, please visit hackernoon.com.

Standing up a mail server is an afternoon: a fresh VPS, one CyberPanel installer command, and you have Postfix, Dovecot and OpenDKIM wired together behind a UI. Making Gmail trust it is the actual job, and it is mostly DNS. This walks the path to a clean mail-tester score: why PTR, OS hostname, Postfix myhostname and a forward A record all have to say the same name, why SPF belongs on the root domain and not the mail subdomain, and how DMARC measures alignment rather than validity. The centrepiece is a bug worth knowing about: Postfix has two milter parameters, smtpd_milters covers mail arriving over SMTP, and non_smtpd_milters covers mail injected locally by sendmail, PHP mail(), or cron. Set only the first and your contact form sends unsigned mail forever, with nothing in the log to tell you. Ends on what a 10/10 does not buy you, which is reputation.