Free tech learning for everyone, from basics to pro

Network FundamentalsNetworking SecurityBeginner

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:

How an email travelsMail clientsubmits on 587Sender'sserverchecks MX ofrecipientRecipient'sserverSMTP on 25,SPF/DKIM/DMARCMailboxstoredRecipientclientIMAP 993 orAPI
Figure 1. SMTP moves mail between servers; IMAP or a provider API lets the recipient read it.
  1. 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.
  2. Lookup: your server looks up the MX records of the recipient's domain to find their mail servers.
  3. Relay: it connects to the recipient's server on port 25 and transfers the message. Servers try STARTTLS encryption between them.
  4. Checks: the receiving server checks the sender's IP reputation, SPF, DKIM and DMARC, and scans for spam and malware.
  5. 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.com telling receivers what to do when SPF or DKIM fail and match the visible From domain: none (just report), quarantine or reject. For example v=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?
587 (SMTP submission with STARTTLS), or 465 with implicit TLS.
How does a sending server find where to deliver mail for a domain?
It looks up the domain's MX records.
What does a DMARC record tell receiving servers?
What to do with messages that fail SPF and DKIM alignment (none, quarantine or reject), and where to send reports.

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.
Tracks your learning on this device only. See your progress on the learning paths.
Verified author✓ Valid
Issued to
Mohamed Fayas
Role
Founder of FM TecHub
Credentials
CCNABTEC HND Network EngineeringBEng (Hons) Computer Networking & Cloud Security
Issuer
FM TecHub · fmtechub.com

He writes practical, plain-English guides on networking, security and cloud.

More about the author →

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.

Email updates: coming soon

New notes, tools and security news from FM TecHub by email, explained simply. Free. We're not collecting email addresses yet; see our privacy policy.

PortServiceStatus
SMTP/25Email updatesopening soon

Meanwhile, stay connected: