This post describes all the things you will have to do, after (or before) installing and configuring your mail server, because that is where it all starts. Without it, you might have problems sending mail, because remote domains might think your server sends spam or is not delegated to send emails for your domain…
For simplicity, our mail server hostname is mail.domain.tld on ip 22.214.171.124, and we are working with postfix.
Mail server should always use its mail hostname when communicating with outer world.
smtp_helo_name = mail.domain.tld
Mail server should have an A record in your domain zone. This is needed only in domain that will handle mails.
mail IN A 126.96.36.199
Reverse address for ip 188.8.131.52 should point back to mail.domain.tld.
$ nslookup mail.domain.tld Server: 127.0.0.1 Address: 127.0.0.1#53 Non-authoritative answer: Name: mail.domain.tld Address: 184.108.40.206 $ nslookup 220.127.116.11 Server: 127.0.0.1 Address: 127.0.0.1#53 Non-authoritative answer: 18.104.22.168.in-addr.arpa name = mail.domain.tld.
Setup which server(s) will be responsible for processing mail, for current domain.
@ IN MX 10 mail.domain.tld.
You can specify multiple servers, with different priorities.
Lets restrict which server are allowed to send emails on behalf of current domain.
This will allows all server, that are specified in MX section:
@ IN TXT "v=spf1 mx ~all"
And this will additionally allow Google’s Gmail to send mails for us:
@ IN TXT "v=spf1 mx include:_spf.google.com ~all"