Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › DKIM

How to Configure SPF, DKIM and DMARC for Node.js SaaS Email in 2026

By Freedom251 Team · · 9 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a Node.js SaaS sending from a custom domain, reliable authentication requires three coordinated layers: SPF authorizes the SMTP envelope sender, DKIM signs the message, and DMARC checks that either authenticated domain aligns with the visible From domain. DNS records and your email provider must be configured separately from application code. Nodemailer can create a DKIM signature and set the SMTP envelope, but it cannot publish DNS records or make a provider’s envelope domain align automatically.

What each authentication layer actually proves

These standards answer different questions. Treating them as interchangeable is the source of many “my From address is correct, so why did SPF fail?” incidents.

As an Amazon Associate I earn from qualifying purchases.

Layer What it evaluates Where configuration lives What a pass means
SPF The SMTP envelope sender domain (the MAIL FROM used during delivery) and the servers authorized to send for it A TXT record at the envelope domain, plus the provider’s sending path The receiving server accepts that the connecting infrastructure is authorized for that envelope domain
DKIM A cryptographic signature attached to the message, identified by a signing domain and selector Private key in the sender or provider; matching public key in DNS The message was signed by the key published for that selector and was not altered in transit
DMARC Whether SPF or DKIM passed and whether its domain aligns with the visible From domain A TXT record at _dmarc.<domain>, followed by report analysis and policy decisions The message meets your alignment policy; enforcement can be monitoring-only or restrictive

DMARC can pass through either aligned SPF or aligned DKIM. Configuring both gives the message a second path when one mechanism is disrupted, such as a provider changing its envelope domain or a forwarding service breaking SPF. AWS explains the alignment model in its DMARC authentication guidance.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Decide your sending architecture before editing DNS

Inventory every sender

List your transactional API, SMTP relays, password-reset worker, billing system, support platform and any marketing sender. Each system that sends as your domain must either be represented in SPF, use a provider-managed envelope that is already authorized, or sign with DKIM from an aligned domain. An overlooked vendor is a common cause of intermittent DMARC failures.

#1 Best Overall
Yubico - Security Key C NFC - Basic Compatibility - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

Separate traffic when reputations or controls differ

Consider using a transactional subdomain such as notify.example.com and a promotional subdomain such as news.example.com. Separation lets you change a provider, investigate complaints or apply a DMARC policy to one stream without immediately affecting account invitations and receipts. It is an architectural choice, not a requirement of SPF or DKIM.

Keep one SPF record per domain

Publish a single SPF TXT record for each envelope domain. Multiple SPF records are evaluated as an error, even if each contains valid mechanisms. Consolidate all authorized services into one record and stay within SPF’s DNS-lookup limit; ask each provider which mechanism it requires rather than copying an example from another service.

Provider setup and DNS are separate from Node.js

First verify your sending identity in the delivery provider’s console or API. Enable its DKIM option and publish the exact DNS records it supplies. The provider controls the selector, key format and, often, the envelope domain used for SPF. Your application can submit a message successfully while authentication fails if those DNS records are missing, stale or published at the wrong hostname.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Amazon SES custom MAIL FROM as a concrete example

Amazon SES requires a verified identity before custom MAIL FROM can be enabled. Choose a dedicated subdomain beneath that verified identity’s parent domain, then publish the SES-supplied MX and SPF TXT records at that subdomain. The values include the AWS region, so use the region shown for your SES configuration rather than substituting a different one. SES uses the MX for bounce and complaint notifications; the subdomain should not also be used for ordinary sending or inbound mail. The provider’s procedure and record requirements are documented in Using a custom MAIL FROM domain.

Rank #2
Yubico - YubiKey 5C NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5C NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5C NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5C NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

SPF authorization for SES is described in AWS’s SPF documentation. Do not invent the TXT or MX value: copy the current value shown for your identity and region.

Configure DKIM in a Node.js application

There are two valid patterns. With provider-managed DKIM, the provider signs after accepting your message; you publish its public key and do not put a private key in the application. With application-managed DKIM, Nodemailer signs before submission, so the selector, private key, signing domain and DNS public key must remain synchronized.

Provider-managed signing

  1. Verify the custom sending domain with your provider.
  2. Enable DKIM and copy every CNAME or TXT record it supplies into your DNS host exactly.
  3. Wait for DNS propagation and use the provider’s verification check.
  4. Configure Nodemailer to submit through the provider’s SMTP endpoint or API. Do not add a second, unrelated DKIM key unless the provider explicitly supports it.

Application-managed signing with Nodemailer

Nodemailer supports one or more DKIM keys. The private key stays on the server; the corresponding public key is published at a selector-specific DNS name. A minimal SMTP transport looks like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import nodemailer from 'nodemailer';

const transporter = nodemailer.createTransport({
  host: process.env.SMTP_HOST,
  port: 587,
  secure: false,
  auth: {
    user: process.env.SMTP_USER,
    pass: process.env.SMTP_PASS
  },
  dkim: {
    domainName: 'example.com',
    keySelector: 'mail2026',
    privateKey: process.env.DKIM_PRIVATE_KEY
  }
});

await transporter.sendMail({
  from: 'Account Team <[email protected]>',
  to: recipient,
  subject: 'Verify your account',
  text: 'Use the verification link in this message.',
  html: '<p>Use the verification link in this message.</p>'
});

The names above are illustrative. Generate and protect your own key, publish its matching public key at the selector required by your DNS design, and rotate selectors deliberately. Nodemailer’s current DKIM behavior is documented at nodemailer.com/dkim.

Rank #3
Yubico - YubiKey 5 NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-A or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5 NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

Do not commit the private key to source control or expose it through client-side JavaScript. Store it in a secrets manager or protected environment variable, restrict file permissions, and plan a second selector for rotation so the old key can remain available while messages signed with it age out.

Understand the SMTP envelope versus the visible From header

SMTP transports a separate envelope containing MAIL FROM and RCPT TO. The reader normally sees the message header From. Nodemailer exposes this distinction through its envelope option, as described in its SMTP envelope documentation:

await transporter.sendMail({
  from: 'Billing <[email protected]>',
  to: customerAddress,
  envelope: {
    from: '[email protected]',
    to: [customerAddress]
  },
  subject: 'Invoice available',
  text: 'Your invoice is ready.'
});

SPF evaluates [email protected] (the envelope domain), not merely [email protected]. For DMARC SPF alignment, the envelope domain must align with the visible From domain according to your policy. If your provider rewrites the envelope to its own domain, SPF may pass but fail DMARC alignment; aligned DKIM can still provide the passing path.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Publish DMARC as a controlled rollout

Start with visibility

Create a TXT record at _dmarc.example.com. Many organizations begin with a monitoring policy, p=none, while they collect aggregate reports and identify legitimate senders. A monitoring policy does not block spoofed mail; it gives you data for correcting sources and alignment.

Rank #4
Yubico - Security Key NFC - Basic Compatibility - Multi-Factor Authentication (MFA) Key, Connect via USB-A or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key NFC via USB-A and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

Inspect sources and alignment

Review reports for every sending service, forwarding path and subdomain. SPF alignment relates the visible From domain to the envelope MAIL FROM domain. DKIM alignment relates the visible From domain to the DKIM signing domain. Fix unknown senders, broken forwarding paths and selector mistakes before increasing enforcement.

Choose enforcement deliberately

After legitimate traffic consistently authenticates, change the DMARC policy to the level your organization can support, such as quarantine or reject. Roll out gradually if you have high-volume or geographically distributed traffic, and continue watching reports after every change. AWS’s DMARC guidance explains the policy and alignment model; it does not choose a policy for your business.

Test the complete path, not just DNS syntax

  1. Send a message through each real application and provider route to representative Gmail and non-Gmail mailboxes.
  2. Open the received message’s “Show original” or equivalent header view.
  3. Confirm that SPF passes for the actual envelope domain, DKIM passes for the intended selector and signing domain, and DMARC passes with alignment.
  4. Check that the From, Reply-To, bounce address and links use the domains you intended.
  5. Repeat after DNS changes, provider migrations, key rotation and any change to SMTP transport.

A successful SMTP response only means the next server accepted the message for delivery. It is not proof that SPF, DKIM or DMARC passed at the recipient.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Gmail requirements that apply to your sending volume

Google’s Email sender guidelines state that, beginning February 1, 2024, all senders to Gmail accounts must set up SPF or DKIM. Senders delivering more than 5,000 messages per day to Gmail accounts have additional requirements:

Best Value
Yubico - YubiKey 5C - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB, FIDO Certified - Protect Your Online Accounts (5C)
  • POWERFUL SECURITY KEY: The YubiKey 5 is a versatile physical passkey that protects your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 secures 100+ of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 via USB and tap it to authenticate. No batteries, no internet connection, and no extra fees required.
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.
  • Use both SPF and DKIM.
  • Publish DMARC; Google says a monitoring policy such as p=none is acceptable.
  • Align the visible From domain with SPF or DKIM.
  • Use TLS for transport and maintain valid forward and reverse DNS.
  • Format messages according to RFC 5322 and keep the spam rate below 0.3%.
  • For marketing and subscribed messages, provide one-click unsubscribe and a visible unsubscribe link in the body.

The 5,000 figure is an operational threshold for messages per day to Gmail accounts, not a universal definition of a bulk sender and not a legal limit. Google’s FAQ says enforcement against non-compliant traffic is ramping up from November 2025. Its sender-guidelines FAQ clarifies that one-click unsubscribe applies to marketing or promotional mail, not transactional messages such as password resets and confirmations. Google can update these pages, so check the live guidance before launch.

US and EU compliance is a separate workstream

SPF, DKIM and DMARC authenticate infrastructure and domains; they do not establish consent, a lawful basis, privacy notice coverage or permission to transfer personal data. The applicable obligations depend on the recipient’s location, message purpose, data categories, relationship with the customer and the providers processing the data. Have your legal or privacy owner assess the specific US and EU scenario, including retention, processor contracts and cross-border transfers. Do not present a passing DMARC result as proof of legal compliance.

Troubleshoot the failures that matter most

SPF returns “permerror” or “multiple records”

  • Query the envelope domain and remove duplicate SPF TXT records.
  • Merge authorized mechanisms into one record and review DNS-lookup consumption.
  • Confirm the provider’s current sending hosts rather than relying on an old setup.

DKIM fails after a key change

  • Verify the selector in the DKIM-Signature header matches the DNS hostname.
  • Check that the public key is complete, unwrapped correctly and published at the right record type.
  • Keep the previous selector published until messages signed with it are no longer in transit.

SPF passes but DMARC fails

Compare the envelope domain shown in the authentication results with the visible From domain. If they do not align, use an aligned custom envelope through your provider or rely on an aligned DKIM signing domain. Changing only the header From value in Node.js does not change the provider’s envelope behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Mail is accepted but lands in spam

Check authentication alignment, TLS, forward and reverse DNS, message formatting, complaint signals and Gmail’s spam-rate guidance. Authentication is necessary for policy compliance but does not guarantee inbox placement.

How to evaluate a delivery provider for a Node.js SaaS

No single provider is established as best for every US or EU SaaS. Compare the operational details that affect your architecture:

Decision area Questions to ask
Region and data handling Where are messages, logs and event data processed, and can the service meet your residency and transfer requirements?
Authentication Does it support custom-domain DKIM, aligned custom MAIL FROM, SPF guidance and DMARC reporting?
Node.js integration Are API and SMTP interfaces documented, with webhooks or events for bounces and complaints?
Operations What quotas, rate limits, suppression tools, reputation controls and monitoring are available?
Commercial terms What is the current price, and how do volume, regions, retention and support affect the total cost?

Document the answers for each provider you consider; a technical feature list alone cannot predict deliverability for your audience.

Launch checklist

  • Every legitimate sender and envelope domain is inventoried.
  • Each domain has one coherent SPF record with current authorized infrastructure.
  • Provider-managed or application-managed DKIM is chosen, and private keys are protected.
  • DKIM public keys, selectors and signing domains are verified in DNS.
  • Any SES custom MAIL FROM subdomain has the provider-supplied regional MX and SPF records and is not used for ordinary mail.
  • DMARC is published at _dmarc, reports are reviewed and enforcement is staged intentionally.
  • Real messages show passing, aligned SPF, DKIM and DMARC headers.
  • Gmail volume, TLS, DNS, formatting, spam-rate and unsubscribe requirements are met for the traffic you send.
  • Legal and privacy review covers the actual US/EU recipients, content and data flows.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

DKIMDMARCDNSemail authenticationGmail deliverabilityNode.jsSaaSSPF

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.