Your mail server will need a PTR
record pointing to it. This will allow reverse DNS to work. I don't trust mail servers which use a second level domain like example.com
as too many spammers try to claim their name is one of the big name domains. You are better off using a name like mail.example.com
. If you are using mail.example.com
add an MX
to your main domain example.com
indicating mail.example.com
will receive mail. By the way neither mail.example.com
nor example.com
can be CNAME
entries.
You can run everything on one domain name. However, if I have convinced you to use mail.example.com
for you mail server, you may want to use www.example.com
for your web server rather than mail.example.com
. If you use www.example.com
it will be easy to add parallel domain for static content which does not receive cookies from your web server.
It is common to have the IP address of the parent domain, example.com
resolve to the web server's address. If you don't have a lot of web traffic you can use a CNAME record for your web domain. The rest of the services not listed above such as POP and IMAP can be handled by CNAME records. If you add different servers later you can replace the CNAME record with an A record, or simply adjust the CNAME record. Using CNAME records ease adding IPV6 as you won't need to add AAAA records to all your domains.
I like to have a DNS record for the hostname. If you do that you can use that domain instead of mail as your MX
. In your example, I would drop the mail.example.com
record and use hostname.example.com
in your MX
record. Add a CNAME record for www.example.com
and you are pretty well done.
Your mail server should use whatever name the PTR
record for your server uses. You may need to get your IP provider to change the PTR
appropriately. Add an A
record for that name as well.
Consider adding SPFs record for both hostname.example.com
and example.com
.