Saturday, February 24, 2018

domain name system - How to set up mx records



So I bought a new domain name from GoDaddy and pointed the domain to my VPS IP Address which works fine.



[Please note, the VPS is not hosted with GoDaddy, just the domain name.]



However, I noticed that all incoming mails from external servers (gmail, yahoomail, other domains, etc) keep bouncing back even though outcoming emails (from my domain to other mail servers work fine).




After googling the issue out, it seems that I need to make changes to my domain's MX Records in order to be able to send/receive mail.



In GoDaddy, the mx records are as follows:



10  @   mailstore1.secureserver.net 1 Hour  
0 @ smtp.secureserver.net 1 Hour


What I have tried so far:





  1. So as instructed by online tutorials and forums, I created an A Record mail.shillong.work and pointed it to my VPS IP Address.


  2. After that, I added this line to the list of MX Records:



    1 @ mail.shillong.work 1 hour




So now it looks like this:



10  @   mailstore1.secureserver.net 1 Hour  

0 @ smtp.secureserver.net 1 Hour
1 @ mail.shillong.work 1 Hour


However, I still can't send anything to any email hosted in my server.



What am I doing wrong?


Answer



The problem seems to be that you have other servers than your mail server listed in your MX record, one of which has a lower priority. MX records work on a lowest-priority-first basis, which means the internet is first of all trying to send mail for your domain to smtp.secureserver.net., which doesn't seem to know anything about your domain. At this point, delivery fails fatally, and there's an end of it; your server, being listed at second priority, will never get tried.




The only mail servers you should list in your MX records are those that either (a) are prepared to accept email for your domain, for final delivery, or (b) are prepared to accept email for your domain with a view to delivering it on to a final delivery server, and are specifically configured to do so.



If you overhaul the MX record for shillong.work to something like



shillong.work.          3600    IN      MX      10 mail.shillong.work.


and remove all other MX records, then wait an hour (for the 3600s TTL to expire), the internet should start delivering your inbound mail to your server.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...