I have some websites on AWS (Windows Server 2012 R2), and I'm trying setup a mail server. I have installed hMailServer, and in the guide say I need configure the DNS records for mail. I never needed setup email server from zero like now, then I'm a bit confused about the DNS records needed for this.

I read in some guide I will need A, MX and PTR records for this. Currently, my registar has only this records:

mydomain.com A  
www.mydomain.com A

Now, I think I will need create that records:

mail.mydomain.com A
mail.mydomain.com MX 10 mail.mydomain.com

My questions:

  1. Am I doing correctly?
  2. What about the PTR record? I needed?
  3. I will/can use this "mail.mydomain.com" like above in SMTP, POP and IMAP? Or I will need create different DNS records for this?
  4. How can I do/know if I did correctly? I was using mxtoolbox, but even there I dont understand if I need inform "mydomain.com" or "mail.mydomain.com" on the tests.
  • 4
    Your MX record should have just mydomain.com. on the left side of the MX record assuming you want email at user@mydomain.com and not user@mail.mydomain.com. – yoonix Mar 24 '17 at 0:18
  • Hey, @yoonix, please, change your comment in a answer and I can mark it as accepted. This was enough to answer my questions. Thanks! – Click Ok Mar 25 '17 at 3:57
  • Generally, running an email server and keeping it working well takes time. I don't bother running my own email server, I use a third party service. It costs very little and saves me a bunch of time. – Tim Mar 25 '17 at 17:16

When other people will write to something@mydomain.com, all SMTP servers in the world will search for the relevant server(s) handling emails for @mydomain.com. For that, they will check the DNS for MX records on mydomain.com, or A/AAAA records if MX records are not found.

MX records will give a priority and an hostname. That hostname can be anything you like (mail.$DOMAIN may be often used but is absolutely not mandatory), even in another domain name (and especially if your email setup is outsourced to a third party).

This is for the outside emails you receive. For POP/IMAP (BTW: nowadays you should skip providing POP altogether, and only provide IMAP over TLS) you should define on which server are the emails stored and where your POP/IMAP daemons will run. This may be the same server as the one on the MX record or another server if you have a complicated email setup. In all cases you could define a DNS record (even a CNAME) for imap.mydomain.com to give to your users (this would make it easier to change it later if you need).

The PTR record comes into play (in some sort) only if your SMTP server do also send emails outside. In such cases, you will need to contact the owner of the IP blocks (v4 and v6) in which your SMTP server has an IP address. It could be your ISP or your hosting company. They will let you know how to setup the PTR record.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.