How email works: SMTP, IMAP, POP3, MX records and SPF, DKIM and DMARC
In short: Email clients hand messages to their own mail server using SMTP submission on port 587. That server looks up the recipient domain's MX record and delivers the message over SMTP on port 25. The recipient reads it with IMAP, POP3 or a provider's own app. SPF, DKIM and DMARC let receiving servers check that a message really comes from the domain it claims.
The journey of a message
Email was designed when the internet was small and friendly, and the basic protocol, SMTP, still carries almost every message today. Several steps happen when you press Send:
- Submission: your mail app sends the message to your provider's server using SMTP submission, normally port 587 with STARTTLS (or 465 with implicit TLS), and logs in.
- Lookup: your server looks up the MX records of the recipient's domain to find their mail servers.
- Relay: it connects to the recipient's server on port 25 and transfers the message. Servers try STARTTLS encryption between them.
- Checks: the receiving server checks the sender's IP reputation, SPF, DKIM and DMARC, and scans for spam and malware.
- Storage and reading: the message lands in the mailbox, and the recipient reads it with IMAP (port 993), POP3 (port 995) or the provider's own protocol, such as Microsoft 365's Exchange APIs.
IMAP or POP3?
- IMAP keeps mail on the server and syncs folders and read status across all your devices. The normal choice today.
- POP3 downloads mail to one device and usually deletes it from the server. Rarely used now.
Many organisations disable both in Microsoft 365 or Google Workspace and allow only modern authenticated apps, because IMAP and POP3 with passwords are popular with attackers.
Stopping spoofed email
SMTP lets anyone put any "From" address on a message. Three DNS-based standards help receiving servers spot forgeries:
- SPF: a TXT record listing which servers may send mail for your domain, for example
v=spf1 include:spf.protection.outlook.com -all. - DKIM: your server signs each message with a private key, and receivers check the signature using a public key published in DNS. It proves the message was not changed and came through your systems.
- DMARC: a TXT record at
_dmarc.example.comtelling receivers what to do when SPF or DKIM fail and match the visible From domain: none (just report), quarantine or reject. For examplev=DMARC1; p=quarantine; rua=mailto:dmarc@example.com.
Large mailbox providers such as Gmail and Yahoo now require SPF, DKIM and DMARC for bulk senders, so even small organisations should set them up. Start DMARC at p=none, read the reports, fix every legitimate sender (newsletters, CRM, invoicing systems), then move to quarantine and reject.
Network engineer's checklist
- Block outbound port 25 from user devices and allow it only from mail servers, so infected PCs cannot send spam directly.
- Make sure your sending IPs have a matching PTR record.
- Allow 587 and 993 outbound if users use external mail apps.
Real-world example: invoices landing in spam
A company's invoices, sent from its accounting software, kept going to customers' junk folders after it tightened its DMARC policy. The accounting service sent mail as the company's domain from its own servers, but the SPF record did not include it and DKIM was not set up. Adding the service's SPF include and publishing its DKIM key fixed delivery within a day.
Practice
Which port do mail apps normally use to submit outgoing mail?
How does a sending server find where to deliver mail for a domain?
What does a DMARC record tell receiving servers?
Key takeaways
- Clients submit on 587; servers relay to each other on port 25.
- MX records tell servers where to deliver mail for a domain.
- IMAP syncs mail across devices; POP3 downloads it to one.
- SPF, DKIM and DMARC let receivers detect spoofed mail.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.