skip to content

Email Protocols

Moving a message into another person's inbox: SMTP transfer, IMAP and POP3 retrieval, SPF, DKIM and DMARC sender checks, and S/MIME signing. Interviewers test protocol reasoning on a federated system.

on this pageshow

explore

questions

142 · 6 sections

Why does SMTP mail submission get its own port 587, and how does a submission agent differ from the MTA on port 25?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Port 587 is RFC 6409's submission port: its submission agent accepts new mail only from authenticated users and may complete the message. Port 25 carries relay between MTAs, takes unauthenticated senders, and should accept mail only for domains it serves.

open as a page

In SMTP, what do a reply code's first and second digits mean, and how does an enhanced status code such as 5.1.1 refine them?

level: juniorimportance: must knowfreq 60%
basics
~20 s

An SMTP reply's first digit gives the outcome: 2 done, 3 send more, 4 temporary failure worth retrying, 5 permanent failure. The second digit names the category, and an enhanced code like 5.1.1 adds class, subject and detail.

open as a page

In SMTP, how does the envelope sender given in MAIL FROM differ from the From header a recipient sees?

level: juniorimportance: must knowfreq 68%
basics
~20 s

MAIL FROM is the envelope reverse-path, sent in the SMTP dialog and used for bounces; From is the author's address inside the message content. RFC 5321 requires no relationship between them, so they can differ.

open as a page

What is the difference between an open SMTP relay and a mail server that relays only for authenticated clients or trusted networks?

level: juniorimportance: must knowfreq 58%
basics
~20 s

An open relay accepts mail from any client for any destination. A correctly run MTA relays to outside domains only for authenticated clients or trusted networks, and accepts everything else only for domains it serves.

open as a page

Why does opportunistic STARTTLS between mail servers not guarantee an encrypted, authenticated hop, and what can a domain do about it?

level: juniorimportance: must knowfreq 50%
basics
~20 s

The STARTTLS offer arrives in cleartext, so an on-path party can remove it and the sender, by design, carries on unencrypted; opportunistic senders also accept any certificate. MTA-STS, DANE or per-destination mandatory TLS make the hop required and authenticated.

open as a page

Under POP3 (110/995), why does mail the office desktop has downloaded never show up on staff phones, and what does IMAP (143/993) do instead?

level: juniorimportance: must knowfreq 62%
basics
~20 s

POP3 is download-and-delete: the desktop retrieves each message and deletes it from the server at QUIT, so the phone finds nothing. IMAP keeps mail on the server for every device. Ports: POP3 110/995, IMAP 143/993.

open as a page

Under RFC 1939, when does a POP3 DELE actually remove a message, and what happens if the connection drops before QUIT?

level: middleimportance: should knowfreq 34%
basics
~20 s

DELE only marks a message; the server removes marked messages when QUIT moves the session from TRANSACTION into the UPDATE state. If the connection drops or times out first, the session never enters UPDATE and nothing is removed.

open as a page

For POP3 access to a mail service offering port 110 with STLS and port 995, which should clients use, and why does RFC 8314 prefer it?

level: seniorimportance: should knowfreq 30%
basics
~20 s

Use port 995: POP3S starts TLS before any POP3 command, so nothing travels in cleartext. RFC 8314 (2018) prefers it to STLS on 110, whose cleartext start a client may fail to upgrade, and treats cleartext login as obsolete.

open as a page

Should an office keep any POP3 access when staff read mail on several devices, and which POP3 and IMAP ports would you leave open?

level: principalimportance: should knowfreq 16%
basics
~20 s

Usually make IMAP on 993 the default and retire POP3 for people; keep POP3 only on 995 for a named single-consumer case, such as a system draining a mailbox, and close cleartext 110 and 143 once nothing needs them.

open as a page

How does a POP3 client leave mail on the server using UIDL, and why does that only partly imitate IMAP's server-side mailbox?

level: seniorimportance: nice to knowfreq 20%
basics
~20 s

The client skips DELE and records each message's UIDL unique-id, downloading only ids it has not seen. The server keeps one flat maildrop with no shared read state or folders, so read state and filing never carry from one device to another.

open as a page

In DNS, which record type carries a domain's SPF policy, and what must the policy's first and last terms be?

level: juniorimportance: must knowfreq 60%
basics
~20 s

An SPF policy is published only as a DNS TXT record at the name it covers. Its text must begin with exactly v=spf1, and it should end with an all mechanism that sets the explicit default result.

open as a page

What are the seven results an SPF check can return, and how does a receiving mail server typically handle each one?

level: juniorimportance: must knowfreq 60%
basics
~20 s

SPF returns pass, fail, softfail, neutral, none, temperror or permerror. RFC 7208 leaves the action to the receiver: it may reject fail, should not reject on softfail alone, must treat neutral like none, and may defer temperror.

open as a page

What does an SPF record ending in +all authorise, and how do its qualifiers and left-to-right matching produce a result?

level: juniorimportance: must knowfreq 48%
basics
~20 s

An SPF record ending in +all authorises every IP address: all always matches and + makes a match pass. Mechanisms are tried left to right; the first match's qualifier (+ pass, - fail, ~ softfail, ? neutral) is the result.

open as a page

Why does adding a second v=spf1 TXT record at the same domain break SPF for all of its mail, and how do you fix it?

level: middleimportance: must knowfreq 46%
basics
~20 s

RFC 7208 allows one record beginning v=spf1 per name; when a receiver selects two, the check returns permerror for every message from that domain. The fix is to merge both into one record with a single all at the end.

open as a page

Why does SPF fail for mail forwarded through an alias, such as an alumni address, when the original sender's record is correct?

level: middleimportance: must knowfreq 45%
basics
~20 s

SPF checks the IP of the server that connected last. A plain forwarder resends from its own IP but keeps the original MAIL FROM, so the receiver checks the sender's record, which never listed the forwarder.

open as a page

Given a DKIM-Signature with d=example.com and s=s2026a, where does a receiver look up the public key, and what must that record contain?

level: juniorimportance: must knowfreq 58%
basics
~20 s

The receiver queries the TXT record at s2026a._domainkey.example.com: the s= selector, the fixed _domainkey label, then the d= domain. The value is a tag list whose only required tag is p=, the base64 public key.

open as a page

When a sending mail server DKIM-signs a message, what exactly does it hash, what does it sign, and where does each result go?

level: juniorimportance: must knowfreq 48%
basics
~20 s

A DKIM signer hashes the body into bh=, then hashes the header fields listed in h= plus its own DKIM-Signature field with b= left empty, signs that hash with the domain's private key, and writes the result into b=.

open as a page

What does a DKIM fail result tell a receiver about a message, and why is it treated like an unsigned message?

level: juniorimportance: must knowfreq 48%
basics
~20 s

DKIM fail means a checkable signature did not match the message as received, so it vouches for nothing. It is not proof of forgery: relays that modify mail break honest signatures, so RFC 6376 says treat it like an unsigned message.

open as a page

In DKIM, what exactly do the simple and relaxed canonicalization algorithms change for header fields and for the message body?

level: middleimportance: must knowfreq 40%
basics
~20 s

Simple hashes headers byte for byte; relaxed lowercases field names, unfolds lines, collapses whitespace runs to one space and trims it at the colon and value end. Both body algorithms drop trailing empty lines; relaxed also strips line-end whitespace and collapses runs.

open as a page

When rotating a DKIM signing key by selector, in what order do you publish, switch and retire, and why does the old record stay published?

level: middleimportance: must knowfreq 42%
basics
~20 s

Publish the new key under a new selector, confirm it resolves, switch signing, keep the old record until queued and late-verified mail has cleared, then revoke the old record with an empty p= and destroy the old private key.

open as a page

What is the difference between DMARC aggregate reports and DMARC failure reports, and which one does a domain owner rely on?

level: juniorimportance: must knowfreq 48%
basics
~20 s

Aggregate reports (RFC 9990, requested with rua) are daily XML summaries of SPF, DKIM and alignment results per sending IP, with no message content; failure reports (RFC 9991, requested with ruf) are per-message ARF samples, and most receivers send none.

open as a page

Under RFC 9989, what must a DMARC policy record at _dmarc.example.com contain to be valid, and what does the smallest useful one say?

level: juniorimportance: must knowfreq 46%
basics
~20 s

A DMARC record must begin with v=DMARC1, spelled exactly, or receivers ignore it, and should carry p=none, quarantine or reject. The smallest useful one is v=DMARC1; p=none; rua=mailto: plus a report mailbox: monitoring with aggregate reports.

open as a page

Under DMARC, what do the policies none, quarantine and reject ask a receiving mail server to do with a message that fails DMARC?

level: juniorimportance: must knowfreq 62%
basics
~10 s

They state the From domain owner's preference for failing mail: none asks for no change, quarantine for treating it as suspicious, reject for refusal during the SMTP session. The receiver's local policy still decides.

open as a page

Why does a domain whose DMARC record publishes p=none get no protection against messages forging its From address?

level: juniorimportance: must knowfreq 58%
basics
~20 s

p=none expresses no handling preference, and RFC 9989 says a discovered p=none MUST NOT change how receivers handle mail, so a forged message is treated as if the domain had no DMARC policy. It buys visibility through reports, not protection.

open as a page

What did Gmail's and Yahoo's 2024 bulk-sender rules require of a sending domain's DMARC, and does p=none satisfy them?

level: juniorimportance: must knowfreq 50%
basics
~20 s

From February 2024 both providers require bulk senders to authenticate with SPF and DKIM, publish a DMARC record (p=none accepted) and send mail whose From domain aligns with SPF or DKIM. p=none meets the record rule but stops no forgery.

open as a page

When a sender S/MIME-encrypts a message to a colleague, whose key protects it, whose private key opens it, and what stays readable in transit?

level: juniorimportance: must knowfreq 55%
basics
~20 s

S/MIME encryption uses each recipient's certificate to protect a random content key, which only that recipient's private key can recover. Body and attachments are hidden end to end; the envelope and outer headers such as From, To and Subject stay readable.

open as a page

In S/MIME, why does losing your private decryption key cut you off from old encrypted mail, while losing your signing key does not?

level: juniorimportance: must knowfreq 46%
basics
~20 s

S/MIME mail is usually stored still encrypted, and only the recipient's private decryption key unwraps each message's content key, so losing it loses the archive. Signatures verify with the signer's public key, so old signing keys are not needed.

open as a page

What does an S/MIME signature on an email show the recipient that the sending domain's DKIM signature does not?

level: juniorimportance: must knowfreq 45%
basics
~20 s

An S/MIME signature is made with the author's own private key and verified with a certificate naming the author's mailbox, so it ties the message body to that person. A DKIM signature ties the message only to the sending domain.

open as a page

In S/MIME, why can you sign a message to anyone but encrypt only to correspondents whose certificate your mail client already holds?

level: juniorimportance: must knowfreq 48%
basics
~20 s

Signing uses your own private key, which you always hold. Encryption wraps the message key under each recipient's public key, found in their certificate, so the client must first obtain and trust it, usually from a signed message they sent.

open as a page

In mail encryption, how does S/MIME's CA-issued identity differ from OpenPGP's web of trust when deciding a correspondent's key is genuine?

level: juniorimportance: must knowfreq 48%
basics
~20 s

S/MIME trusts a key because a certification authority the client already trusts issued a certificate binding it to the mailbox. OpenPGP users create their own keys, and each receiver decides validity from certifications by people it trusts or its own checks.

open as a page