How Email Works From Send to Inbox
Follow one message from the Send button to the recipient's inbox, including DNS lookups, server handoffs, spam checks and retries.
Key takeaways
- Email moves from your app to your provider's server, then to the recipient's server, and finally to the recipient's device.
- Servers find each other through MX records in DNS, which name the hosts that accept mail for a domain.
- SMTP carries mail toward its destination, while IMAP or a provider's own protocol lets you read it afterward.
- The receiving side decides whether to accept, reject, delay or file a message as spam.
- A temporary failure causes the sending server to retry; a permanent one produces a bounce notice.
When you press Send, your mail app hands the message to your provider's outgoing server. That server looks up which machine accepts mail for the recipient's domain, connects to it and passes the message along. The receiving system checks it, files it in a mailbox, and the recipient's app fetches or syncs it from there.
The whole trip often takes seconds, but it is built as a chain of handoffs. Each server takes responsibility for the message before the previous one lets go. Once you can picture that chain, delays, bounces and spam folder surprises become much easier to explain.
The cast of characters
Email documentation uses a few abbreviations that are worth knowing, because error messages and help pages use them.
| Role | Common name | What it does |
|---|---|---|
| Your mail app or webmail page | MUA, mail user agent | Lets you write and read messages |
| Outgoing server for your account | MSA, mail submission agent | Accepts mail from you after you sign in |
| Server that moves mail between domains | MTA, mail transfer agent | Routes and relays messages |
| Server that places mail in a mailbox | MDA, mail delivery agent | Applies filters and stores the message |
One company's system often plays several of these roles at once. In a large hosted service, each role may be a whole fleet of machines. The logical steps stay the same.
An address such as [email protected] has two halves. The part after the @ is the domain, which decides where the message goes. The part before it is the local part, which only the receiving system interprets.
Step 1: your app composes and submits the message
Your app builds the message as plain text with a defined structure. At the top are header fields such as From, To, Subject and Date. After a blank line comes the body. Formatted text and attachments are packaged using a set of rules called MIME, which lets a text-based system carry images, documents and multiple versions of the same content.
Then the app submits the message. It connects to your provider's submission server over an encrypted connection, usually on port 587 or 465, and proves who you are with a password or a sign-in token. If you use webmail, your browser sends the draft to the provider over HTTPS and the provider's own systems do the submission step internally.
Authentication at this point matters a great deal. It is how your provider knows that you are allowed to send as your address, and it is one reason open servers that relay mail for anyone are treated as a serious misconfiguration.
Step 2: the sending server looks up the destination
Your provider now needs to know where mail for example.com should go. It asks DNS for the domain's MX records. Each MX record names a mail host and gives it a preference number, and the lowest number is tried first. The server then looks up the address records for that host to get an IPv4 or IPv6 address.
A domain might publish this:
example.com. 3600 IN MX 10 mx1.example.com.
example.com. 3600 IN MX 20 mx2.example.com. Here mx1 is preferred, and mx2 is the fallback if the first cannot be reached. The details of preference values and common mistakes are covered in how MX records point mail to your server.
Step 3: the two servers talk SMTP
SMTP, the Simple Mail Transfer Protocol, is the language servers use to hand mail to each other, normally on port 25. The conversation is a series of short commands and numbered replies. Simplified, it looks like this:
S: 220 mx1.example.com ready
C: EHLO mail.example.net
S: 250-mx1.example.com
S: 250 STARTTLS
C: STARTTLS
(the connection is encrypted, and EHLO is repeated)
C: MAIL FROM:<[email protected]>
S: 250 OK
C: RCPT TO:<[email protected]>
S: 250 OK
C: DATA
S: 354 Send the message
C: (headers, blank line, body, then a single dot)
S: 250 Message accepted MAIL FROM and RCPT TO form the envelope. Servers route and bounce mail using the envelope, which can differ from the From and To lines you see in the message. That difference is normal for mailing lists and blind copies, and it is also what forgers try to exploit.
When the receiving server answers 250 after the message data, it has accepted responsibility. The sender can delete its queued copy.
Step 4: the receiving system decides what to do
Accepting a connection is not the same as trusting it. Before, during and after the transfer, the receiving side asks several questions:
- Does the connecting IP address have a history of abuse, or sensible reverse DNS?
- Is the sending server allowed to use this domain, according to SPF?
- Does a valid DKIM signature show the signed parts arrived unchanged?
- What does the domain's DMARC policy ask receivers to do when those checks do not match the visible sender?
- Do the content, links and attachments resemble known spam or malware?
- Has this recipient, or people like them, reported similar mail?
The result can be rejection during the SMTP conversation, a temporary deferral, delivery to the spam or quarantine area, or delivery to the inbox. Each provider weighs the signals its own way and publishes only part of its method.
Step 5: the message reaches a mailbox and your devices
After acceptance, a delivery component places the message in the recipient's mailbox. Server-side rules may move it to a folder, forward it or send an automatic reply.
The recipient's phone or computer then learns about it. With IMAP, the messages stay on the server and each device shows a synchronized view, so reading something on your phone marks it read on your laptop. With the older POP3, a client typically downloads messages to one machine. Many large providers also use their own APIs and push notifications in their apps. The differences are laid out in SMTP, IMAP and POP3 explained.
Webmail skips the download concept. Your browser displays what the provider stores, which is convenient on a borrowed or new device and depends on a working connection unless offline features are switched on.
What happens when something goes wrong
Mail is designed to survive temporary trouble. SMTP replies beginning with 4 mean "try again later". The sending server keeps the message in a queue and retries at increasing intervals, often for several days, before giving up. Your message may arrive late without anyone doing anything.
Replies beginning with 5 mean the failure is permanent, such as an address that does not exist. The sending system then generates a bounce message back to you. Reading those notices is a skill of its own, described in what happens when an email bounces.
Some failures produce no notice at all. A message filtered into spam was successfully delivered from the server's point of view. So "I never got it" has several possible answers:
- Ask the recipient to check spam, quarantine and any filtering rules.
- Check the exact address you typed, character by character.
- Look for a bounce in your own spam folder.
- If you manage the domain, search the server's delivery logs for the recipient and read the final reply code.
Where delays and surprises come from
A few ordinary mechanisms explain most odd behavior:
- Greylisting. Some servers deliberately defer mail from unfamiliar senders once, expecting real mail servers to retry.
- Large messages. Attachments grow when encoded and may exceed the limits of either side. See why attachments have size limits.
- Forwarding. A forwarded message arrives from a server the original domain never authorized, which can upset some checks.
- Scanning. Security gateways may hold a message while they examine links or open attachments in an isolated environment.
- DNS changes. Cached records can send mail to an old host for a while after a provider move.
If you want to see the actual route a message took, open its full source and read the trace lines. Reading email headers shows how, including how to work out where time was lost.
How private is the trip?
Most large providers encrypt the connection between servers using TLS, and your app's connection to your provider should always be encrypted. That protects the message on the wire. It does not hide it from the providers themselves, which can process and scan stored mail, and server-to-server encryption is frequently negotiated on a best-effort basis.
Protecting content so that only the recipient can read it requires end-to-end methods such as PGP or S/MIME, which both people must set up. The trade-offs are covered in is email encrypted?
Common questions
Why did my message arrive hours late?
Usually a temporary failure somewhere in the chain. The receiving server was busy, rate limiting or greylisting you, and your server retried later. The timestamps in the headers show which hop waited.
Can I take back a sent email?
Generally not once another provider has accepted it. "Undo send" features work by holding the message for a few seconds before submitting it. Recall features inside a single organization's mail system have conditions and do not reach outside addresses.
Do I need my own server to use my own domain?
No. You can point your domain's MX records at a hosted mail provider and publish its authentication records. Setting up email on your own domain walks through that.