Sending Transactional Email
Why password resets and receipts need a transactional email service, not your own SMTP server, and what SPF, DKIM, and DMARC actually fix.
Sending Transactional Email
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- Transactional email is triggered by something a specific user just did — a signup, a password reset, a purchase — and marketing email is sent to a list to shape future behavior; mixing them onto the same sending infrastructure risks both.
- A password reset that lands in spam, or arrives 20 minutes late, isn't a minor inconvenience — it's a broken feature, which is why transactional email has a much higher reliability bar than a newsletter.
- Running your own SMTP server means starting with zero sending reputation and no tooling for bounce handling, blocklist monitoring, or warm-up — all problems a dedicated transactional email API has already solved at scale.
- SPF and DKIM are two independent ways a receiving mail server verifies a message is actually from who it claims to be from; DMARC is the policy layer that tells receivers what to do when one or both checks fail.
- None of this is optional anymore for serious deliverability — major inbox providers now require authenticated sending for anyone sending real volume, regardless of which provider you use to send it.
Not all email is the same job
“Send an email” sounds like one feature, but a password reset and a monthly newsletter aren’t the same job wearing different clothes. A password reset is transactional: it’s triggered by one specific user doing one specific thing, that user is actively waiting for it, and it’s expected regardless of any marketing opt-in status — a user who unsubscribed from your newsletter still needs their password reset to arrive. A newsletter is marketing: sent to a list, not triggered by an individual action, governed by opt-in/opt-out consent rules, and fundamentally fine with being delayed or landing in a “Promotions” tab.
Receipts, order confirmations, “your report is ready,” two-factor login codes, “your payment failed” — all transactional. A sale announcement, a product update digest, a re-engagement campaign — all marketing. The test is simple: did one specific user just do something that this email is a direct consequence of? If yes, it’s transactional.
The embedded video above walks through this same transactional-vs-marketing split and then spends most of its time on the SPF/DKIM/DMARC half of this lesson — it’s a solid single source for both halves, and the sections below go further on the DNS-record specifics and the exact alignment rule that trips people up.
The reason this distinction matters operationally, not just semantically, is deliverability. Marketing email, by its nature, generates spam complaints and unsubscribes at a much higher rate than transactional mail — that’s just the nature of sending promotional content to a list. If transactional and marketing mail share the same sending domain and infrastructure, a drop in marketing sender reputation (from complaints on a campaign) can drag down the inbox placement of your password-reset emails too. Serious senders keep them on separate sending domains or subdomains for exactly this reason — isolating a reputation problem on one side from affecting delivery on the other.
Why failure here is a bigger deal
A delayed marketing email is a missed opportunity. A delayed or spam-filtered password-reset email is a user who is, right now, locked out of their account, refreshing their inbox, about to open a support ticket or just give up and churn. Transactional email doesn’t get graded on the same curve — there’s effectively no acceptable rate of failure or delay, because every single message has an actual user on the other end who is blocked until it arrives.
This is also exactly why transactional email tends to get wired up through a background job rather than sent inline during the request that triggers it — you don’t want your signup endpoint blocked on, or failing because of, a slow or flaky call to an email provider’s API. The request handler enqueues “send welcome email,” and a worker handles the actual send, with retries if the provider’s API has a bad moment.
Why not just run your own mail server
Setting up an SMTP server and sending mail directly feels like it should be simple — install Postfix, point your app at it, done. The reason almost nobody does this at any real scale comes down to one word: reputation. Every mail server has a sending reputation attached to its IP address and domain, built from history — how often its mail gets marked as spam, how many of its recipients don’t exist (bounces), how consistent its sending volume is over time. A brand-new server has none of that history, which major inbox providers (Gmail, Outlook, Yahoo) treat as suspicious by default. Mail from an unfamiliar sender gets filtered hard, sometimes for weeks, while the sender “warms up” — and warming up requires sending real mail your real users see end up in spam the whole time you’re building that trust.
A dedicated transactional email service (SendGrid, Postmark, Resend, Mailgun, and similar) has already done this work, at a scale no individual company could replicate cheaply: established sending reputation, often on IP ranges shared with other well-behaved senders (or a dedicated IP once you’re sending enough volume to warrant one), automated bounce and complaint processing, blocklist monitoring, and infrastructure built specifically around the reliability bar transactional email needs. You’re not paying for “the ability to send an email” — SMTP can do that for free — you’re paying for inbox placement, which is a much harder problem that these services have already solved.
SPF, DKIM, and DMARC: proving you are who you say you are
Here’s the part that’s true no matter which provider you use: you still need to configure DNS records proving your domain actually authorized whoever is sending mail on its behalf. This exists because plain SMTP has no built-in way to verify a sender’s identity — anyone can put anything in a message’s From header, which is exactly what makes email spoofing and phishing possible in the first place. Three standards, working together, fix this.
SPF (Sender Policy Framework) is a DNS record listing which mail servers are allowed to send email claiming to be from your domain:
example.com. TXT "v=spf1 include:sendgrid.net include:_spf.google.com ~all"
A receiving server checks the IP address the message actually arrived from against this list. If your transactional email provider’s sending servers aren’t listed, SPF fails for mail sent on your behalf.
DKIM (DomainKeys Identified Mail) adds a cryptographic signature to each outgoing message, generated with a private key your sending provider holds, that a receiving server verifies against a public key published in your DNS. A valid signature proves two things: the message really was signed by a server holding your domain’s private key, and its content wasn’t altered in transit. Where SPF checks “did this come from an approved server,” DKIM checks “is this message’s content genuinely what the sender signed.”
DMARC (Domain-based Message Authentication, Reporting, and Conformance) is the policy layer sitting on top of both. It’s a DNS record that tells receiving servers two things: what to do when a message fails SPF, DKIM, or both (p=none just monitor, p=quarantine send to spam, p=reject bounce it outright), and where to send reports about those failures so you can see who’s sending mail claiming to be you. Critically, DMARC also requires alignment — the domain that passed SPF or DKIM has to match the domain shown in the message’s visible From address, not just pass in some technical sense for an unrelated domain. That alignment check is what actually closes the spoofing loophole: without it, an attacker could pass SPF for their own throwaway domain while displaying your company’s name in the From field.
Together, these three give a receiving mail server a real answer to “should I trust that this message is actually from this domain” — and at this point, they’re not optional extras. Gmail and Yahoo now require authenticated sending (SPF or DKIM, with DMARC in place) from anyone sending meaningful volume, rejecting or heavily filtering mail that isn’t. A transactional email provider makes the sending infrastructure easy; you still own getting these DNS records right for your own domain, and it’s worth treating that setup as a required step, not an optional hardening pass you’ll get to later.
Check yourself
What's the actual difference between transactional email and marketing email?
Transactional email is triggered by something a specific user did — a password reset, an order confirmation, a login code — and the user is actively expecting it. Marketing email goes to a list to promote something and isn't tied to an immediate user action. The distinction matters because they have very different reliability and consent requirements, and sending them from the same infrastructure can let marketing complaints hurt the deliverability of time-sensitive transactional mail.
Why is a delayed or spam-filtered transactional email a bigger problem than a delayed marketing email?
A user requesting a password reset is actively blocked until that email arrives — it's not a 'maybe later' message, it's a broken feature in the moment it fails. A marketing email arriving a day late or getting filtered is a missed opportunity, not a support ticket. Transactional email effectively has no acceptable delay or failure tolerance.
Why do most backend teams use a transactional email service (SendGrid, Postmark, Resend, and similar) instead of running their own SMTP server?
A new mail server starts with zero sending reputation, and inbox providers are slow to trust unfamiliar senders — mail can land in spam for weeks during 'warm-up.' A dedicated service already has established sender reputation (sometimes on a dedicated IP), plus built-in bounce processing, complaint handling, and blocklist monitoring that you'd otherwise have to build and maintain yourself for a problem that isn't your product's core business.
What do SPF and DKIM each actually verify, and how is DMARC different from both?
SPF checks whether the server that sent the message is on a list the domain owner published as allowed to send on their behalf. DKIM checks a cryptographic signature attached to the message, proving its content wasn't altered in transit and really came from a server holding the domain's private signing key. DMARC doesn't check the message itself — it's a policy, published in DNS, telling receiving servers what to do (quarantine, reject, or do nothing) when a message fails SPF, DKIM, or both, and whether to send the domain owner reports about failures.
Why would a message 'pass' SPF but still fail DMARC?
DMARC requires alignment, not just a bare pass — the domain that SPF (or DKIM) actually validated has to match the domain shown in the message's visible From address. A message can pass SPF for the sending service's own domain while the visible From address claims to be your company's domain; without alignment, DMARC treats that as a failure, which is exactly the spoofing scenario DMARC exists to catch.
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.