18.8. Email Delivery Best Practices
Table of Contents
Understanding Email Delivery Quality
When you send an email from your backend, two big questions matter:
- Does it reach the inbox and not the spam folder?
- Does it actually get delivered and not silently dropped?
This chapter focuses on the practical habits and technical settings that improve your chances of reliable, inbox‑bound delivery.
We assume you already know the basics of sending emails and SMTP from earlier chapters. Here we focus on best practices only.
Use a Reputable Email Service Provider
Running your own SMTP server correctly is possible, but for most backend applications, a dedicated Email Service Provider (ESP) is safer and faster.
Common options:
| Provider type | Examples | Typical use |
|---|---|---|
| Transactional email services | SendGrid, Mailgun, Postmark | App notifications, password resets, etc. |
| Cloud provider email services | AWS SES, GCP SendGrid, Azure | Apps already on cloud platforms |
| Marketing / bulk email platforms | Mailchimp, Brevo, ConvertKit | Newsletters, campaigns |
Key reasons to use an ESP:
- They handle IP reputation, bounce management, and feedback loops.
- They provide dashboards, logs, and metrics.
- They usually have SDKs and APIs that integrate well with backend frameworks.
For transactional backend emails (password resets, verifications, receipts) choose a transactional ESP. Avoid mixing transactional and marketing emails from the same sender domain if possible, or at least use different sending subdomains (for example app.example.com vs news.example.com).
Configure DNS Authentication Properly
Modern email delivery depends heavily on DNS records that prove your server is allowed to send emails for your domain.
You typically configure three key mechanisms.
SPF
SPF (Sender Policy Framework) tells the world which servers may send email using your domain.
Example SPF TXT record for the root domain:
example.com. TXT "v=spf1 include:sendgrid.net include:_spf.google.com ~all"Meanings:
v=spf1identifies SPF version.include:sendgrid.netsays "servers SendGrid uses are allowed to send for my domain".include:_spf.google.commight allow Google Workspace to send email for the same domain.~allmeans “soft fail” for others. Use-all(hard fail) only when you are certain all senders are listed.
Always have only one SPF TXT record per domain.
If you need multiple services, put multiple include: parts into a single record.
DKIM
DKIM (DomainKeys Identified Mail) signs each outgoing email with a cryptographic signature. Receivers verify that:
- The email was not changed in transit.
- It was sent by a server with access to your domain’s private key.
The ESP usually gives you one or more DKIM records like:
s1._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb..."s1is the selector. Your provider might use names likedefault,smtp, or a random string.p=is the public key that receivers will use to validate DKIM signatures.
In your ESP dashboard, you will usually see a status like "DKIM: verified" once DNS propagation finishes.
DMARC
DMARC tells receivers what to do with emails that fail SPF or DKIM checks for your domain and also lets you collect reports.
Typical DMARC record:
_dmarc.example.com. TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com; ruf=mailto:dmarc-fail@example.com; fo=1"Key tags:
v=DMARC1protocol version.p=policy:nonemonitor only, no action.quarantinesend suspicious emails to spam or hold for review.rejectdrop them completely.rua=where to send aggregate reports.ruf=where to send forensic failure reports.fo=1ask for a report on every failure.
Typical rollout strategy:
- Start with
p=noneto see what is sending on your behalf. - Clean up unauthorized senders.
- Move to
p=quarantine, then eventuallyp=reject.
SPF, DKIM, and DMARC must agree on your domain.
Use the same sending domain in your “From” header that you have configured in DNS records.
Choose Good Sender Addresses and Domains
The sender identity strongly influences spam filters.
Use a Real Domain, Not Free Email Addresses
Avoid sending transactional emails "from" yourapp@gmail.com or other free email providers while using an external SMTP service. This usually conflicts with DMARC and looks suspicious.
Better:
- Register your own domain, for example
example.com. - Use a subdomain for sending:
mail.example.com,notify.example.com, orapp.example.com.
Use Clear, Human Senders
Better sender formats:
YourApp Notifications <no-reply@example.com>YourApp Support <support@example.com>
Even for automated messages, consider not using no-reply@ if you want to allow replies or if it can hurt user trust. Some systems still use no-reply but make sure your app provides clear support channels.
Consistent sender addresses:
- Use one stable sender address per type of message:
security@example.comfor security alerts.billing@example.comfor invoices.notifications@example.comfor general transactional mail.
Write Inbox‑Friendly Email Content
Spam filters look at both content and behavior.
Avoid Spammy Subject Lines
Bad examples:
"!!! IMPORTANT MESSAGE !!!","100% FREE","Earn $$$ Now".
Better:
"Reset your YourApp password""Your YourApp verification code""Your receipt from YourApp"
Keep subjects:
- Clear and honest.
- Short but descriptive.
- Free of unnatural punctuation and all‑caps.
Write Clean, Simple Body Text
Guidelines:
- Use simple, direct language.
- Avoid heavy use of sales buzzwords in transactional emails.
- Do not use misleading phrases like "RE:" or "FWD:" to trick users.
For transactional emails, include:
- Who the email is from.
- Why the user is receiving it.
- Clear next steps or information.
Example password reset email:
Subject: Reset your YourApp password
Hi {{user_name}},
We received a request to reset the password for your YourApp account.
To reset your password, click the link below:
{{reset_link}}
If you did not request a password reset, you can safely ignore this email.
Thanks,
The YourApp teamAlways Include a Plain-Text Version
Many transactional emails are HTML. You should also include a plain text version. Most ESPs support this directly.
Benefits:
- Accessibility for screen readers.
- More compatible with older email clients.
- Some spam filters favor emails that have both HTML and text.
Provide a Clear Unsubscribe or Preference Link for Non‑Essential Emails
For marketing or optional notifications, provide an unsubscribe mechanism. Even if not legally required for a simple transactional app, this is a good habit and lowers spam complaints.
Examples:
Unsubscribe from these emails: {{unsubscribe_link}}.- Or a "Notification preferences" page where users can disable some types of emails.
For strictly required emails like password resets or receipts, you still should explain why the user got it, but unsubscribe is usually not applicable.
Respect Legal and Compliance Requirements
Different regions have different laws for email, like CAN‑SPAM (US), GDPR (EU), CASL (Canada).
General best practices:
- Identify your company in the footer:
- Company or app name.
- Postal address or registration info, where required.
- Provide a clear way to opt out of marketing emails.
- Do not send marketing emails to people who have not given consent, especially under GDPR or similar laws.
- Do not hide your identity.
- Honor unsubscribe and deletion requests promptly.
These rules mostly apply to marketing or bulk emails, but following them in transactional contexts improves user trust.
Manage Bounces and Invalid Addresses
Bounces are delivery failures. They affect your reputation, especially if you ignore them.
Two main types:
| Type | Meaning |
|---|---|
| Hard bounce | Permanent failure, such as non‑existent address. |
| Soft bounce | Temporary problem, such as mailbox full or server down. |
Track Bounces via Your ESP
Most ESPs:
- Mark addresses that hard‑bounced.
- Can send webhooks or events when a bounce occurs.
- Might automatically stop sending to bad addresses.
You should:
- Stop sending emails to addresses that hard‑bounce.
- Review soft bounces if they are frequent for the same address.
Example logic in your backend:
- Receive bounce webhook from provider.
- Mark the user’s email as "invalid" or "delivery problem".
- Optionally prompt the user next time they log in to confirm or update their email.
Continuing to send to invalid or bouncing addresses will damage your sender reputation and can cause broad deliverability problems.
Handle Complaints and Unsubscribes Correctly
Email providers offer feedback loops that tell ESPs when users click "This is spam".
Your ESP might:
- Surface "complaint" events in logs or webhooks.
- Automatically add those addresses to a suppression list.
Your backend should:
- Immediately stop sending non‑essential emails to addresses that complain.
- Optionally mark them as "unsubscribed due to spam complaint".
For explicit unsubscribes:
- Honor them immediately.
- Do not require login for a simple "stop all marketing emails" action.
- Confirm visually (on a web page) that the user has been unsubscribed.
Throttle and Warm Up Sending Volume
If your app is new or your IP/domain has little history, sending a large burst of emails can look suspicious.
Warm Up New Domains and IPs
When starting out:
- Begin with small volumes, for example a few hundred per day.
- Increase gradually over several days or weeks as long as bounce and complaint rates are low.
ESP dashboards often include recommended warm‑up schedules. Follow those if provided.
Avoid Sudden Spikes
Even later, avoid patterns like:
- Sending 50,000 emails in 1 minute after days of no activity.
Better:
- Spread large sends over time.
- Use background jobs and queues to schedule sending.
Example strategy:
- Use a background worker that takes emails from a queue.
- Configure a rate limit, such as "max 1000 emails per 5 minutes" per provider or per domain if needed.
Use Background Jobs for Sending
In your backend, sending email should almost never block the main request for long.
Typical pattern:
- User submits an action that triggers an email, such as registration or password reset.
- Your API:
- Saves the necessary data (email address, type of email, payload) in a queue or jobs table.
- Quickly responds to the user (for example "Check your inbox").
- A background worker:
- Reads jobs from the queue.
- Sends emails via the ESP.
- Handles retries on temporary failures.
Benefits:
- Faster user responses.
- More reliable delivery with retries.
- Easier throttling and rate limiting.
Be careful to:
- Only retry soft failures.
- Stop retrying after a reasonable number of attempts or time limit.
Monitor Key Email Metrics
Track delivery quality over time. Most ESPs show these metrics.
Important metrics:
| Metric | Description | Typical target |
|---|---|---|
| Delivery rate | Delivered / Sent | As high as possible, ideally > 98% |
| Bounce rate | Bounced / Sent | Preferably below 1% |
| Complaint rate | Spam complaints / Delivered | Keep below 0.1% |
| Open rate | Opened / Delivered | Varies by email type and audience |
| Click rate | Clicked / Delivered or Clicked / Opened | Depends on email purpose |
| Unsubscribe rate | Unsubscribes / Delivered | Higher for marketing, low for transactional |
If bounce or complaint rates rise:
- Verify SPF, DKIM, DMARC are correct.
- Check whether you are sending to old or purchased lists (avoid this).
- Review content, subject lines, and frequency.
- Confirm that only opted‑in users receive marketing emails.
Use Proper Message Headers
Correct headers help spam filters and improve user experience.
Common headers for transactional emails:
From: YourApp Notifications <notifications@example.com>
To: Alice <alice@example.org>
Subject: Your YourApp password reset
Message-ID: <unique-id-1234@example.com>
Date: Tue, 27 Aug 2026 10:15:00 +0000
Reply-To: support@example.com
List-Unsubscribe: <https://example.com/unsubscribe?token=...>Notes:
Message-IDshould be unique per email and usually include your domain.Reply-Tocan point to a monitored inbox.List-Unsubscribemakes it easy for email clients to show a native "Unsubscribe" button, which can reduce spam complaints for bulk or marketing emails.
Your ESP usually handles many of these but you should know what they do and configure them where appropriate.
Test Deliverability Across Providers
Delivery can differ between providers (Gmail, Outlook, Yahoo, corporate servers).
Testing checklist:
- Create test accounts on multiple providers.
- Send test emails from your app:
- Password reset.
- Verification email.
- Marketing email if applicable.
- Check:
- Does it arrive in the inbox, spam, or not at all?
- Does the HTML render correctly?
- Are links and tracking parameters working?
- Are images blocked by default?
You can also use specialist tools or services that analyze headers and content and provide a “spam score” with suggestions.
Keep Your Infrastructure Secure
If your sending account or API keys are compromised, attackers can send spam pretending to be you. This quickly destroys your domain reputation.
Best practices:
- Store SMTP passwords and ESP API keys as secrets, not in source code.
- Rotate keys if you suspect any compromise.
- Restrict access to ESP dashboards and logs with strong authentication, preferably with MFA.
- Monitor sending patterns for anomalies, such as sudden spikes.
If you detect abuse:
- Immediately revoke the compromised keys or password.
- Stop suspicious sending.
- Investigate which addresses might have received spam.
- Work with your ESP to clean up reputation issues if needed.
Summary Checklist
Use this list as a quick reference when setting up email delivery for your backend:
- Domain and DNS:
- SPF configured correctly, only one record.
- DKIM keys set and verified.
- DMARC with at least
p=nonefor monitoring. - Sender identity:
- Use your own domain and suitable subdomains.
- Clear, consistent From names and addresses.
- Content:
- Clear subjects, no spammy wording or tricks.
- Clean body with both HTML and plain text.
- Unsubscribe or preferences links for non‑essential emails.
- Behavior:
- Use background jobs and queues.
- Warm up volumes, avoid sudden spikes.
- Handle bounces, complaints, and unsubscribes promptly.
- Monitoring and security:
- Track delivery, bounce, complaint, and unsubscribe rates.
- Secure ESP credentials and dashboards.
- Regularly send test emails across providers.
Following these practices from the start makes your backend’s email both reliable and trusted, which is essential for features like authentication, password reset, and user notifications.
Views: 7
KAHIBARO