If you're sending emails and they keep landing in the recipient’s spam folder, there's a good chance your DNS settings are incomplete or incorrect. Before you blame your email service, test your domain setup using mail-tester.com. It will show you a score along with a detailed breakdown of what's missing or misconfigured.
Let’s say you own the domain sekmen.dev
Your mail server domain is mail.sekmen.dev
Your mail server IP address is 1.2.3.4
Here’s what you need to do to stay out of the spam folder:
📩 1. Set Your MX Record
This tells other mail servers where to send messages for your domain.
| Type | Name | Content |
| ---- | ---------- | --------------- |
| MX | sekmen.dev | mail.sekmen.dev |
🌐 2. Define an A Record for the Mail Server
This links your mail subdomain to a fixed IP address. Make sure your mail server has a static IP.
| Type | Name | Content |
| ---- | --------------- | ------- |
| A | mail.sekmen.dev | 1.2.3.4 |
🔐 3. Add an SPF Record
This defines which servers are authorized to send emails on behalf of your domain.
| Type | Name | Content |
| ---- | ---------- | ------------------------------------------------------- |
| TXT | sekmen.dev | "v=spf1 ip4:1.2.3.4 a mx ptr include\:unluco.com \~all" |
Replace 1.2.3.4
and include:unluco.com
with your actual IP and providers.
✉️ 4. Set Up DKIM
DomainKeys Identified Mail (DKIM) signs your messages to prove they haven't been tampered with.
| Type | Name | Content |
| ---- | -------------- | ----------------------------------- |
| TXT | dm.\_domainkey | v=DKIM1; k=rsa; p=YourPublicKeyHere |
Generate this with your mail server and DNS provider. The public key is usually a long string.
🛡️ 5. Configure DMARC
This tells receiving servers what to do when messages fail SPF or DKIM checks.
| Type | Name | Content |
| ---- | ------- | ---------------------------------------------------------------------- |
| TXT | \_dmarc | v=DMARC1; p=quarantine; rua=mailto\:admin\@sekmen.dev; pct=100; aspf=r |
Start with p=none
while testing, then switch to quarantine
or reject
for full protection.
🔁 Don’t Forget Reverse DNS and PTR Records
Ask your hosting provider or email platform to configure reverse DNS and PTR records for your IP address. These link your IP back to your mail domain and are required for most email providers to trust your server.
✅ Final Tip
Make sure your server authenticates all outgoing mail. Use TLS for encryption and regularly monitor your domain reputation.
Once everything is set up correctly, test again using mail-tester.com and aim for a score of 9/10 or higher. Proper configuration takes just a few minutes but can save you from endless email headaches.