I am having some serious problems setting up the proper DNS addresses for my domain.

My DNS records are like

mail              A         ip1 (shared hosting provider)
mail              A         ip2 (VPS mail server)
info              A         ip2
mail.info         CNAME     domain.com
info.domain.com   MX    5   mail.info

Now, from server 2. I am able to send emails but when someone replies to the email then I am not receiving the email. there might be some issues in these above DNS records. can someone please help me figure it out?


Solution 1:

The way you've set that up translates to the following:

A server that tries to send email to [email protected] opens a connection to mail.info, which in itself is a CNAME for domain.com.

If you want Server2 (which I assume has the IP ip2) to receive email sent to [email protected], you'll need to change that record to point to mail.domain.com

But you also have 2 records for mail.domain.com, which means that the DNS server will round-robin load balance between those records, so incoming mail will randomly be sent to either ip1 or ip2, which is probably not what you want.

Here's how you'd usually set this up:

mail              A         1.2.3.4 (mail server)
domain.com.       MX    5   mail.domain.com

Do note that if you add multiple MX records for a domain, it's assumed that any of those servers are responsible for any mail sent to that domain. And any particular email is only sent to a single mail server, not to every mail server listed in DNS.

EDIT:

Here's how I would configure it based on the comments below:

mail1             A         ip1 (shared hosting provider)
mail2             A         ip2 (VPS mail server)
info              A         ip2
domain.com        MX    5   mail1
info.domain.com   MX    5   mail2