After recently releasing a web application for my sister, I soon found out that a lot of emails we sent as a confirmation were not delivered. I figured they were going to the Junk Mail folder, but I soon found out that they were not even being delivered. I contacted namecheap support and soon found out why.
I’m using the namecheap Private Email service for my SMTP server, and I configured my Laravel application to use the SMTP service rather than an API. Initially, I configured my DNS with two MX records. I also used one SPF record to limit the sender to just privateemail.com. I thought once I set this up, I’d be fine. I was led to believe this because I could test sending email to myself, and I received it without any problems.
After releasing the web application for my sister, she soon told me not everyone was getting the emails. My next step was to contact support. Fortunately, Ihor at Private Email knew exactly what to do. I soon found out what was missing from my DNS entries and how I could test it.
The two missing items from my DNS configuration were the DMARC and DKIM TXT records. Using namecheap, I could quickly generate the DKIM record right on their dashboard. Instructions for creating these records on namecheap can be found here.
To generate the DMARC record, I used the DMARC Record Wizard found on another site. The instructions are simple, and you will be able to quickly get your other TXT entry.
After providing these two additional records to my DNS records, I went to Mail Tester to see if my configuration was suitable. The site asks you to send an email to an email address that they provide, and after that email is received they can rate your configuration. For my test, I sent the email exactly how I send it to the users of my web application. I simply used artisan tinker to send an email:
Mail::raw('I am trying to see if the email for my sisters app is getting out. Can you let me know?', function($msg) { $msg->to('test-randomstring@srv1.mail-tester.com')->subject('Welcome to My Email Configuration Test'); });
Surprisingly, this was extremely fast. I did this whole configuration within 5 or 10 minutes. By the time I ran the test; the DNS was up, the email was received immediately, and the score came back from Mail Tester a 10/10. I was pretty impressed with this and notified my sister. I then created a “Resend Email” button on her dashboard, and after that all of her recipients were receiving the emails.
So for me to feel confident in my email deliveries going forward, I will expect to need five DNS records related to the mail server. My configuration looks like this:
