{"canonical_url":"https://engineer.company/glossary/email/","content_markdown":"# Email\n\n## What it is\n\nEmail is the system that carries a written message to an address of the form `name@domain` and\nleaves it in a mailbox until its owner reads it. It is also spelled e-mail, and the standards that\ndefine it mostly just say mail. Nothing about it requires the reader to be online when the message\nis sent: servers accept the message, hold it and pass it on, which is why it is described as\nstore-and-forward rather than as a conversation.\n\nTwo documents do most of the defining. RFC 5322 says what a message is: a block of header fields,\none blank line, then the body. RFC 5321 describes SMTP, the protocol a sending server uses to hand\nthat message to the next server on the way. To find the next server, a sender looks up the\ndomain's mail exchanger records in DNS, which name the machines willing to accept mail for it.\n\nA complete message can be very short:\n\n```text\nFrom: Ana Holm \u003cana@example.org\u003e\nTo: orders@example.com\nDate: Fri, 16 Oct 2026 09:14:00 +0200\nSubject: Invoice 114 has the wrong VAT number\nMessage-ID: \u003c20261016.0914.ana@example.org\u003e\n\nHello, could you send a corrected copy?\n```\n\nOnly two of those header fields are compulsory: the date and the originator's address. Everything\nelse is optional by the letter of the standard, though a message without a subject or a message\nidentifier looks careless to the programs that sort mail. Lines may run to 998 characters at most\nand should stay within 78, because plenty of mail programs still cut off or wrap anything longer.\n\nThere is a second, hidden layer. SMTP moves the message inside an _envelope_: a return address,\nwhere reports of failure go, and a list of recipients. The envelope and the `From:` and `To:` lines\nthe reader sees are separate and often differ. A blind copy works because the recipient is on the\nenvelope and absent from the headers; a mailing list works because the envelope's return address\npoints at the list, so a dead subscriber's bounce reaches the list software instead of the person\nwho wrote the post.\n\n## Why it matters\n\nAn email address is the identity most of the web falls back on. Sign-up confirmations, password\nresets, receipts, invoices and the alert that a payment has bounced all travel by mail, so a\nproduct whose mail goes missing has users who are locked out without anyone noticing. The person\nwho never received their confirmation link rarely writes to say so. They leave.\n\nEmail also has no owner. Any domain can run its own servers, and any server can talk to any other,\nand that openness is why it has outlasted almost every messaging service built since. The price is\ntrust. The original design lets a sender write anything in the `From:` line, so receiving servers\nnow decide for themselves whether to believe a message, and they decide from evidence the sending\ndomain publishes in DNS: which hosts may send for it, which keys sign its mail, and what to do with\na message that claims the domain and carries neither.\n\nFor a business the useful split is between two kinds of traffic. Transactional mail goes to one\nperson because of something that person just did: a code, a receipt, a reset link. Bulk mail goes\nto many people because the sender chose to send it. They earn reputations separately, draw\ncomplaints at different rates and are often sent from different domains, so mixing them lets a\nnewsletter that annoys people slow down the password reset.\n\nFinally there is where mail lives. Running a mail server means storage, spam filtering, patching\nand a sending reputation that has to be earned and kept. A hosted mailbox for reading and a\nsending provider for automated mail is the usual answer, and it is a choice worth making on purpose\nrather than by default.\n\n## What it looks like in practice\n\nOn one platform mail carried verification, notifications, digests and campaigns, and a single\nprovider made every outage total. The answer was to put\n[three providers behind one interface with automatic failover](/portfolio/built-email-with-failover-and-delivery-logging/):\nSendGrid first, then SMTP2GO and Azure Communication Services. Inbound webhooks report what each\nprovider did with a message, and both sides land in a send log and a delivery event table, so\nthe provider-reported delivery status can be queried instead of guessed. Campaigns to segments\nof users run on a separate broadcast schema of 5 tables and 24 functions, built apart from\ntransactional mail because it is a different problem. A startup check sends a real message through\nthe stack behind a flag; in development a failure logs a warning, and in staging and production it\nstops the process. The page names the cost too: three integrations to keep working, and delivery\nlogs that grow and have to be pruned.\n\nThe company's own mail starts in DNS. Its zone holds about twenty records, among them mail routing\nthrough a hosted mailbox provider, a transactional sending domain and the authentication records\nfor both, and\n[the whole zone is kept as data in the repository](/portfolio/reconciled-a-20-record-dns-zone-as-code/)\nand reconciled against the provider's API. An audit entry point reports the difference between the\ndeclaration and what is being served without changing anything, and it is the part used most.\n\nWhere the company's own mail lives was settled by arithmetic. Its public services run on\n[one host with 512 MB of memory](/portfolio/a-whole-company-on-one-small-server/), and mail\nis kept off that machine on purpose: a mail server needs headroom the host has already spent, so it\nis written as an install scaffold waiting for a host of its own. Meanwhile letters to the company\nare read in its own mailbox, hosted with Apple iCloud, and there is no mailing list behind it.\n\n## Where it goes wrong\n\n**Mail starts landing in spam the week a provider changes.** Nothing in the application changed,\nyet receivers grow suspicious. The domain's published records still name the old sender, so mail\nfrom the new one arrives unsigned or from a host the domain never authorised. Add the new sender\nto the records before the switch, keep the old one until its last message has gone, and, if the\ndomain asks for them, read the aggregate reports receivers send back.\n\n**The application boots, and nobody receives anything.** An expired key or a suspended sending\naccount looks exactly like a working configuration until a real person waits for a code. Send a\nreal message at startup wherever silence is dangerous, and record what the provider says happened\nto each message, so that a missing mail can be traced rather than argued about.\n\n**Bounces pile up at an address nobody reads.** The envelope's return address points at a\n`no-reply` box, so permanent failures arrive and stay unopened. The sender keeps writing to\nmailboxes that closed a year ago, and receivers read that as the habit of a spammer. Point the\nreturn address at something that processes reports, and stop mailing an address after a permanent\nfailure.\n\n**A temporary refusal gets treated as final.** SMTP replies starting with 4 mean try again later;\nreplies starting with 5 mean stop. A sender that gives up on the first 4xx loses mail that a busy\nor cautious server would have accepted half an hour on. RFC 5321 asks for retries at least 30\nminutes apart and a give-up time of at least four to five days; transactional mail usually wants\nquicker retries with backoff, and a clear record when it finally stops trying.\n\n## Further reading\n\n- [RFC 5322: Internet Message Format](https://www.rfc-editor.org/rfc/rfc5322) — the header fields,\n  the blank line, the line-length limits and the two fields every message must carry.\n- [RFC 5321: Simple Mail Transfer Protocol](https://www.rfc-editor.org/rfc/rfc5321) — the\n  envelope, the reply codes, mail exchanger lookup and the advice on retrying.\n- [RFC 7208: Sender Policy Framework (SPF)](https://www.rfc-editor.org/rfc/rfc7208) — how a domain\n  lists the hosts allowed to send mail in its name.\n- [RFC 6376: DomainKeys Identified Mail (DKIM) Signatures](https://www.rfc-editor.org/rfc/rfc6376)\n  — signing headers and body with a key the receiver fetches from DNS.\n- [RFC 7489: DMARC](https://www.rfc-editor.org/rfc/rfc7489) — tying both checks to the visible\n  `From:` domain, with a policy and reports; an informational document rather than a standard.\n\n\u003chttps://engineer.company/glossary/email/\u003e\n","date_modified":"2026-11-12T05:34:23Z","description":"How email moves from sender to mailbox, why the envelope and the visible From line differ, and the four faults that send real mail to spam or nowhere.","formats":{"gemtext":"https://engineer.company/glossary/email/index.gmi","gopher":"https://engineer.company/glossary/email/gophermap","html":"https://engineer.company/glossary/email/","json":"https://engineer.company/glossary/email/index.json","markdown":"https://engineer.company/glossary/email/index.md","pdf":"https://engineer.company/glossary/email/index.pdf"},"kind":"page","language":"en","title":"What is email?","url":"https://engineer.company/glossary/email/","version":1}