← Back to blog

Why Are My Emails Going to Spam? A Developer's Guide

shipcheckshipcheck
··11 min read
Why Are My Emails Going to Spam? A Developer's Guide

Why Are My Emails Going to Spam? A Developer's Guide :

You have a working website. Your signup form works. Your backend sends the email successfully. Your application logs say everything is fine.

And yet, the email lands in spam.

This is one of those problems that can be surprisingly difficult to diagnose because email sent successfully does not necessarily mean email delivered successfully.

Your application may have done its job perfectly. The receiving mail server may still decide that your message isn't trustworthy enough for the inbox.

For developers, email deliverability sits somewhere between application code, DNS configuration, authentication, infrastructure, and reputation. A problem in any one of these areas can affect where your emails end up.

Let's look at the most common reasons and, more importantly, what you can check.

First: Sending an Email Is Not the Same as Delivering One :

When your application sends an email, there are several steps between your server and the recipient's inbox.

Your application generates the message.

An email service or SMTP server accepts it.

The recipient's mail server receives it.

The recipient's mail server checks whether the message looks legitimate.

Finally, the provider decides whether the email belongs in the inbox, spam folder, or somewhere else.

So if your application says:

text Email sent successfully

that only tells you that your sending system accepted the message.

It doesn't guarantee inbox placement.

This distinction is important when debugging email problems.

Check Your SPF Record :

SPF stands for Sender Policy Framework.

It tells receiving mail servers which servers are allowed to send email on behalf of your domain.

For example, if your application sends emails through a third-party email provider, your SPF record needs to authorize that provider.

A simplified SPF record might look like:

text v=spf1 include:example-email-provider.com ~all

The exact value depends on your email provider.

A common mistake is assuming that SPF is automatically configured because you connected an SMTP service.

It usually isn't.

Things to check :

Make sure:

  • Your domain has an SPF record.
  • It contains the correct sending provider.
  • You don't have multiple SPF records.
  • Your SPF record hasn't exceeded the allowed DNS lookup limit.
  • Old email providers aren't still included unnecessarily.

Multiple SPF records are particularly problematic.

You should have one SPF policy for a domain, not several separate TXT records beginning with v=spf1.

Don't Forget DKIM :

DKIM stands for DomainKeys Identified Mail.

While SPF verifies whether a server is authorized to send email for your domain, DKIM adds a cryptographic signature to outgoing messages.

The receiving server can then verify that the email was actually authorized by your domain and hasn't been modified in transit.

Your email provider will usually give you a DKIM record to add to DNS.

It might look something like:

text selector1._domainkey.example.com

The exact hostname and value depend on your provider.

If you're sending transactional emails from your application, DKIM should be considered part of your production setup, not an optional extra.

Set Up DMARC :

DMARC brings SPF and DKIM together.

It tells receiving mail servers what to do when a message doesn't pass authentication checks.

A basic DMARC record might look like:

text v=**DMARC1**; p=none; rua=mailto:[dmarc@example.com](mailto:dmarc@example.com)

Starting with p=none is often useful while you're monitoring your domain and making sure legitimate email sources are configured correctly.

Once you're confident that everything is authenticating correctly, you can consider a stricter policy.

The important thing is not to copy a random DMARC record from a tutorial and forget about it.

Your DMARC policy should reflect how your organization actually sends email.

  1. Check Your From Address :

Here's another common problem.

Your application might send through an email provider while using a completely different domain in the From address.

For example:

text From: [notifications@company.com](mailto:notifications@company.com)

while the underlying sending service is configured for another domain.

This doesn't automatically mean the email will go to spam, but authentication alignment matters.

Your SPF, DKIM, DMARC, and From domain should make sense together.

If you recently changed email providers, this is one of the first things worth checking.

Your Domain Reputation Matters :

Email providers don't judge messages only by authentication.

They also consider sender reputation.

If a domain consistently sends unwanted email, generates spam complaints, or behaves suspiciously, its reputation can suffer.

This becomes especially important for new domains.

A brand-new domain suddenly sending thousands of emails is more likely to attract scrutiny than an established sender with a consistent history.

For developers, this means your email infrastructure should be designed around realistic sending patterns.

Don't treat email as an afterthought just because the code that sends it is only a few lines long.

Check What You're Actually Sending :

Authentication isn't the only thing that matters.

The content of your emails can also affect how they are classified.

Be careful with:

  • Excessive promotional language
  • Misleading subject lines
  • Suspicious links
  • URL shorteners
  • Large numbers of images
  • Poorly formatted HTML
  • Missing plain-text versions
  • Attachments users weren't expecting

Transactional emails should look like transactional emails.

If someone requests a password reset, they should receive a clear password-reset message rather than something that looks like a marketing campaign.

Don't Ignore DNS :

Email depends heavily on DNS.

Your application may be running perfectly while your email configuration is broken because of an incorrect DNS record.

At minimum, review:

  • SPF
  • DKIM
  • DMARC
  • MX records
  • Sending-domain configuration
  • DNS propagation

If you've recently changed DNS providers or moved domains, don't assume everything updated instantly.

DNS changes can take time to propagate, and a small configuration mistake can affect delivery.

Test More Than One Email Provider :

An email arriving in Gmail doesn't necessarily mean everything is perfect.

Try testing with several providers when you're troubleshooting:

  • Gmail
  • Outlook
  • Yahoo
  • Corporate email
  • A custom domain

Different providers use different filtering systems.

If your emails consistently land in spam across multiple providers, you probably have a configuration or reputation issue worth investigating.

If they only fail with one provider, the problem may be more specific.

  1. Check Your Email Provider's Logs :

Your email provider should give you some visibility into what happened after your application submitted a message.

Look for statuses such as:

text Delivered Deferred Bounced Rejected Blocked

These statuses tell very different stories.

A bounce means the message couldn't be delivered.

A rejection means the receiving server refused it.

A spam placement may not appear as an obvious failure because the receiving server technically accepted the message.

That's why application logs alone aren't enough.

Your application can report success while the recipient never sees the email in their inbox.

  1. Make Email Checks Part of Your Website Audit :

Email configuration is easy to forget during a website launch.

Developers typically check:

  • Whether the application builds
  • Whether pages load
  • Whether APIs respond
  • Whether forms work
  • Whether authentication works

But email infrastructure deserves a place on the same checklist.

SPF, DKIM and DMARC are part of your production setup.

A useful pre-launch audit should catch obvious DNS and email configuration problems before users discover them.

That's one of the areas Shipcheck checks as part of its automated website audit, alongside SEO, security, performance, broken links and other production-readiness checks.

A Simple Email Deliverability Checklist :

Before launching a website that sends email, check:

  • SPF is configured
  • There is only one SPF record
  • DKIM is enabled
  • DMARC is configured
  • The From domain is correctly configured
  • DNS records are correct
  • Email provider authentication is complete
  • Transactional emails have sensible content
  • Bounce and delivery logs are being monitored
  • Emails have been tested with multiple providers
  • Password resets and other critical emails have been tested
  • Production email configuration is different from test/staging where appropriate

The Bigger Lesson :

When an email goes to spam, the instinct is often to blame the email itself.

Sometimes that's correct.

But very often, the real problem is somewhere underneath the message: DNS, authentication, domain reputation, sender configuration, or infrastructure.

For developers, email deliverability should be treated as part of production readiness.

Your application isn't truly ready to ship if important emails aren't reaching users.

Before launch, check the infrastructure that users never see.

Because those invisible systems are often the ones that cause the most visible problems.

REFERENCES :

  • Google Workspace, Email sender guidelines
  • Google Workspace, Set up SPF, DKIM, and DMARC
  • RFC 7208 — Sender Policy Framework (SPF)
  • RFC 6376 — DomainKeys Identified Mail (DKIM)
  • RFC 7489 — Domain-based Message Authentication, Reporting, and Conformance (DMARC)

Ready to ship with confidence?

Catch bugs before your users do. Start your free audit today.