I have email delivery issues, and MXtoolbox says "Reverse DNS is not a Valid Hostname". I have A and AAAA records for domain.com and mail.domain.com. The data center has set up reverse DNS to domain.com. I have found this and this thread where users reported similar issues and it appears the issues were resolved by 'changing the hostname' from 'domain.com' to 'something.domain.com'.
I am not comfortable because, to my knowledge, the hostname it is just 'some random word' that I change with the $ hostname
and $ hostnamectl
commands. Also, I heard here that that it should be changed in /etc/postfix/Main.cf
for the purpose of email delivery. If you recommend, I'd like to change the hostname to 'server.domain.com' and, I have gathered that it should match 'helo' in the email. Right now, the hostname is of the form domain.com
and helo is 'domain.com' according to a recipient of an email.
This question is about how I should configure the VPS to reach this goal. My attempt for the purpose of email delivery would be something like the following. The VPS uses debian. Everything is quite generic, I use postfix, OpenDKIM and certbot. Feel free to use it as a template to start your answer, if you want, and modify as needed.
1. Should I new hostname into the terminal?
$ su
$ hostname server
$ hostnamectl set-hostname server
$ vim /etc/postfix/main.cf
Then change
myhostname = domain.com
to myhostname = server.domain.com
mydestination = $myhostname, domain.com, localhost.com, , localhost
to mydestination = $myhostname, domain.com, localhost.com, localhost
To the following file, /etc/hosts, ensure there is a line that reads
127.0.0.1 server.domain.com server
To /etc/resolv.conf add a line that reads
domain domain.com
2. Should I set up reverse dns? I assume I should set the reverse DNS to server.domain.com. Is it correct?
Other steps How should I modify the dns records? IN ADDITION to A and AAAA records to domain.com, mail.domain.com, www.domain.com and www.mail.domain.com, currently there are four email related records:
domain.com 300 MX 10 mail.domain.com
_dmarc.domain.com 3600 TXT v=DMARC1; p=reject;rua=mailto:[email protected]; fo=1
domain.com 3600 TXT v=spf1 mx a:mail.domain.com -all
mail._domainkey.domain.com 3600 TXT v=DKIM1; k=rsa; p=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
How should these be changed? Would I have to add A and AAAA records for server.domain.com?
Which other steps are required?
And if you have time to explain what each step achieves, it would be great.