DEV Community

Leadcanal
Leadcanal

Posted on

Email Deliverability for SaaS: SPF, DKIM, DMARC Setup and Resend Integration

Building email into a SaaS product looks easy at first.

You connect an email API, create a template, call the send endpoint, and the message is delivered.

But production email is more complicated.

Your application may successfully send an email while the message still ends up in spam, fails authentication, or damages your domain reputation.

For SaaS applications, a reliable email system needs two layers:

Email API integration + correctly configured sending infrastructure

This guide walks through SPF, DKIM, DMARC, DNS verification, and a practical Resend integration.

Why Email Deliverability Matters for SaaS

A SaaS application may send:

Account verification emails
Password resets
Login codes
Billing notifications
Product updates
Onboarding sequences
Usage alerts
Marketing emails

If an important transactional email does not reach the inbox, the problem becomes more than an email issue.

It becomes a product experience issue.

A user who cannot receive a password-reset email may assume your application is broken.

That is why deliverability should be treated as infrastructure.

Step 1: Use a Dedicated Sending Domain or Subdomain

Before integrating your email provider, decide how email should be separated from the rest of your domain.

For example:

example.com

might be your main website.

You could then use a dedicated subdomain for email infrastructure:

mail.example.com

or another provider-supported configuration.

Separating email functions can make infrastructure easier to manage, particularly when multiple systems send mail for the same company.

However, don't invent DNS records yourself. Use the exact records generated by your email provider.

Step 2: Add Your Domain to Resend

In Resend, domain verification is handled through the Domains workflow.

Once a domain is added, Resend provides the DNS records required for the sending configuration. Resend currently enforces SPF and DKIM for its authenticated sending setup and recommends DMARC.

Add the records at the DNS provider that controls your authoritative nameservers.

This could be:

Cloudflare
Route 53
GoDaddy
Namecheap
Your hosting provider

The exact DNS interface will differ, but the values should match what Resend provides.

Step 3: Configure SPF

SPF helps receiving mail systems determine whether a sending system is authorized to send mail for a domain.

A common mistake is creating a second SPF policy when one already exists.

Before changing SPF, inspect your current TXT records.

From a terminal:

dig TXT example.com

Look for a record beginning with:

v=spf1

If other services already send email for your domain, review the complete SPF configuration before making changes.

You can also use the LeadCanal Domain Scanner to perform live DNS checks for SPF, DKIM, and DMARC configuration.

Step 4: Configure DKIM

DKIM adds a cryptographic signature to outgoing messages.

The sending service signs the email using a private key, while the corresponding public information is published through DNS.

When the message arrives, the receiving server can validate the signature.

With Resend, DKIM is part of the domain-authentication process.

After publishing the record provided by Resend, wait for DNS propagation and verify the domain from the dashboard.

Resend's updated domain-verification interface can now indicate whether DKIM, https://leadcanal.com/spf-checker/, MX, or other required records are still propagating or failing validation.

Step 5: Configure DMARC

DMARC builds on SPF and DKIM and adds policy and alignment.

A basic monitoring policy historically looked like:

v=DMARC1; p=none; rua=mailto:dmarc@example.com

Starting with monitoring can help you understand legitimate sending sources before moving toward stricter enforcement.

An important 2026 update is that DMARC has now been standardized through new RFCs. The updated specification changes some details—including removal of the old pct mechanism—but existing DMARC records generally continue working.

For domains already sending production email, don't jump directly to an aggressive policy without understanding all legitimate senders.

A typical progression is:

p=none

Monitor authentication

Fix legitimate failures

p=quarantine

Monitor again

p=reject

Resend similarly recommends monitoring and understanding your senders before tightening DMARC enforcement.

For a quick configuration check, the LeadCanal Domain Scanner can analyze SPF, DKIM, and DMARC records together.

Step 6: Install Resend in Your SaaS Application

For a Node.js application, install the Resend package:

npm install resend

Then initialize the client with an API key stored in an environment variable:

import { Resend } from 'resend';

const resend = new Resend(process.env.RESEND_API_KEY);

Never hard-code a production API key directly into application source code.

Step 7: Send a Transactional Email

A simple implementation might look like:

import { Resend } from 'resend';

const resend = new Resend(process.env.RESEND_API_KEY);

const { data, error } = await resend.emails.send({
from: 'Acme notifications@example.com',
to: ['user@example.net'],
subject: 'Welcome to Acme',
html: 'Your account is ready.',
});

if (error) {
console.error(error);
} else {
console.log(data);
}

Use a sender address under a domain you have properly configured and verified.

Resend official website provides REST APIs and official SDKs for several programming languages.

Step 8: Separate Transactional and Marketing Logic

A SaaS product should distinguish between emails users need and emails used for marketing.

Transactional messages include things such as:

Password reset
Account verification
Invoice
Security alert
Login code

Marketing messages include:

Newsletter
Feature promotion
Product announcement
Sales campaign

Even when the same provider handles both, keep the application logic and audience rules clear.

This makes consent handling, suppression, debugging, analytics, and deliverability management easier.

Step 9: Handle Bounces and Suppressions

Sending is only half the workflow.

Your application also needs to understand what happens afterward.

Monitor:

Delivered
Bounced
Complained
Unsubscribed
Suppressed

Repeatedly attempting delivery to addresses that should no longer receive messages is bad operational practice.

Resend currently provides suppression handling, bounce information, webhook events, DNS monitoring, and deliverability-related features as part of its email infrastructure.

Step 10: Use Webhooks

For a production SaaS application, don't rely solely on the result returned by your initial API request.

Use webhook events to update your application when the email state changes.

A simple architecture looks like:

SaaS Application

Resend API

Email sent

Mailbox Provider

Resend Webhook

Your Application

Update email status

This lets your application track delivery events independently from the original request.

Step 11: Monitor DNS After Deployment

DNS configuration is not something you should configure once and completely forget.

Records can accidentally change during:

DNS migrations
Registrar changes
Email-provider migrations
Employee offboarding
Infrastructure changes
New marketing-tool integrations

A previously healthy domain can therefore develop authentication problems later.

LeadCanal's Domain Scanner performs live DNS lookups and checks SPF, DKIM, DMARC and related authentication configuration.

Resend also provides DNS monitoring and domain-verification diagnostics for its own sending infrastructure.

Common SaaS Email Deliverability Mistakes

A technically working API integration does not mean your email infrastructure is healthy.

Common mistakes include:

Using an unverified domain — production email should use properly authenticated infrastructure.

Incorrect SPF configuration — especially when several platforms send mail for one domain.

Missing DKIM — prevents recipients from validating the provider's DKIM signature correctly.

Ignoring DMARC — leaves less visibility and control over domain authentication.

Sending to poor-quality addresses — increases unnecessary bounce risk.

Ignoring suppression events — repeatedly sending to problematic recipients can hurt reputation.

Treating transactional and marketing email identically — they serve different purposes and should be managed accordingly.

Hard-coding API keys — credentials belong in environment variables or an appropriate secret-management system.

Recommended SaaS Email Architecture

A practical setup looks like this:

                    ┌──────────────────┐
                    │   SaaS Product   │
                    └────────┬─────────┘
                             │
                      Resend SDK/API
                             │
                    ┌────────▼─────────┐
                    │      Resend      │
                    └────────┬─────────┘
                             │
             SPF + DKIM + DMARC Alignment
                             │
                    ┌────────▼─────────┐
                    │ Mailbox Provider │
                    └────────┬─────────┘
                             │
                     User's Inbox
                             │
                       Event/Result
                             │
                    ┌────────▼─────────┐
                    │     Webhooks     │
                    └────────┬─────────┘
                             │
                    SaaS Event Database
Enter fullscreen mode Exit fullscreen mode

The important point is that API integration and deliverability infrastructure are separate layers of the same system.

Final Checklist

Before sending production SaaS email, verify:

Domain verified

SPF configured

DKIM passing

DMARC published and monitored

Sending addresses use the authenticated domain

API credentials stored securely

Bounce and suppression handling enabled

Webhook events processed

Transactional and marketing workflows clearly separated

DNS configuration monitored

Final Thoughts

For SaaS founders and developers, email deliverability should be treated like any other production dependency.

Connecting Resend is only the application layer.

Reliable email requires:

Resend integration + SPF + DKIM + DMARC + clean recipient data + bounce handling + monitoring

Get those pieces right early, and email becomes reliable infrastructure instead of something you troubleshoot every time a customer says

Top comments (0)