I was losing emails for years without knowing

Written by pedro.kostelec | Published 2017/01/11
Tech Story Tags: custom-domain | email | dns

TLDRvia the TL;DR App

Yesterday I realized that emails addressed to my @pedro.si email address were often delayed and sometimes even lost. I have been using my own domain for email for over two years, before I realized that something was wrong. The reason for the lost incoming emails was a CNAME record for my naked domain.

So how did I find out? One of the applications I developed, zatresi.si, sends me an emails whenever some data on the website changes. I send these emails using Mailgun, a service for email tracking. Mailgun also shows when emails are successfully delivered.

Mailgun allows me to monitor email deliveries and tracking.

Last week, as I was peeking into Mailgun, I saw that some emails were being retried.

MailGun was reporting delays in delivering emails to my domain.

Why were they delayed so many times? I emailed myself a few times and each time the emails went through without delay. And then once… a delay happened.

I checked the MX records and they seemed fine. However, my DNS hosting service support noticed some problems. They pointed me to intodns.com/pedro.si which was showing red warning flags. The tool was reporting that the nameservers were lame.

intodns was telling that I had lame nameservers

By this time I realized that sometimes the MX settings appeared correctly, but othertimes, they failed to register. I used the MXToolbox to check my MX settings. Occasionally the following warning would appear:

I also noticed that when I was seeing this warning in the MXToolbox, intodns was reporting that the nameservers were lame.

I asked the DNS hosting service support to help me figure out why the nameservers were reported lame with my DNS settings. Instead of answering the question, they asked me to reverse the name and value fields for the MX records. Their suggestion did not help at all, so I undid after waiting for more than 24hrs for the records to propagate. My original MX configuration was valid.

During this time, I was constantly emailing myself to check if the delay was still occurring. One time, I noticed that the after many unsuccessful delivery attempts, the email was completely dropped. I was losing emails! I wonder how many emails I had lost due to this issue in the past 2 years!

A colleague then pointed out that SOA records on pedro.si were missing, and he suggested that I look into it. So far, I had ignored this error as I was not familiar with SOA records and attributed the errors to the lame nameservers.

I then mentioned the missing SOA records to the DNS hosting service support. They replied that the SOA record was having difficulties because the root domain pedro.si had a CNAME to the Amazon S3 server. I use Amazon S3 to host my website. They suggested that I use A records instead for forwarding the root domain to the www label.

After removing the mentioned CNAME record, my emails started working correctly.

intodns.com is no longer reporting that the nameservers are lame, and the SOA record is no longer missing.

Now, while I am happy that my emails are back online, I’ll learn more about the meaning of each DNS record type. The errors I made to my DNS configuration occurred because I ignorantly followed instructions in tutorials and documentation without truly understanding what was going on.

In conclusion, avoid CNAME records for forwarding the root domain to the www label. Use A records, or better yet ALIAS or ANAME records instead. If your DNS hosting service doesn’t support them and you don’t want to use another DNS host, you might want to check out wwwizer’s naked domain redirect. This service redirects visitors from your root domain to your www domain if you point your naked domain A-record to an IP.


Published by HackerNoon on 2017/01/11