Email for IT: From SMTP to the Inbox
A free, hands-on email course for IT: how SMTP, MX, MIME and IMAP work, SPF, DKIM and DMARC, why mail lands in spam, HTML email and images, with real labs.
published
- lessons
- 19
- study time
- 34 h
- level
- beginner
- price
- free
What you'll be able to do
- Trace one email from the sender's app to the recipient's inbox and name every server, protocol and port on the way
- Read a raw message: the envelope, every header, MIME parts, encodings and attachments
- Speak SMTP, IMAP and POP3 by hand, and read SMTP reply codes and bounce messages
- Publish correct MX, PTR, SPF, DKIM, DMARC, MTA-STS, TLS-RPT and BIMI records for a domain
- Explain DMARC alignment, roll a domain from p=none to p=reject, and read aggregate reports
- Run a mail server with Postfix and Dovecot, and set up Google Workspace or Microsoft 365 for a domain
- Migrate a domain between mail providers without losing a single message
- Explain exactly why a message lands in spam, and fix it: authentication, reputation, content, list quality and engagement
- Meet the Gmail, Yahoo and Microsoft sender requirements and send bulk mail that keeps reaching the inbox
- Build HTML email that renders in Gmail, Outlook and Apple Mail, and add images the right way
- Send email from application code with queues, retries, bounce handling and one-click unsubscribe
- Defend an organization against spoofing, phishing and BEC, and run email day to day as an IT admin
Email is the oldest service on the Internet that everyone still uses every day, and one of the least understood. Most people who run it know which buttons to click in an admin console, but not what those buttons change: which DNS record a receiving server reads, why a message that passed SPF still failed DMARC, or why a perfectly honest newsletter goes to spam. This course starts from zero and goes all the way down, so that afterwards no email problem is a mystery.
Who this course is for
IT people in the broadest sense: system and network administrators, help desk engineers who keep getting “my email didn’t arrive” tickets, developers whose applications send email, DevOps engineers who own a domain’s DNS, and anyone who has to set up email for a company. No email background is assumed. You should be comfortable in a terminal, and it helps to know what DNS is; if you don’t, the Networking & the Internet course covers it in its DNS lesson.
How it works
The course is split into five days, plus a wrap-up with the final exam. Days 1 and 2 build the foundations (protocols, DNS, servers), day 3 is sender authentication, day 4 is deliverability and troubleshooting, and day 5 covers HTML email, sending from code, security and administration. Go at your own pace, but go in order: every lesson builds on the ones before it. Each lesson ends with a self-check; if you can’t tick every item without looking, re-read that part before you move on.
Set up the lab
You need one Linux machine: a VM, WSL2 or a cheap VPS all work. In the labs you run a real mail server (Postfix and Dovecot) on that machine, talk to it by hand, sign messages with DKIM and score them with a spam filter. Everything listens on 127.0.0.1, so nothing you do in the labs sends email to the Internet.
# Debian / Ubuntu
sudo apt update
sudo apt install -y postfix dovecot-imapd dovecot-pop3d swaks dnsutils \
opendkim-tools spamassassin openssl netcat-openbsd python3 python3-venv curl
# a Python environment for the scripting labs
python3 -m venv ~/mail-lab && ~/mail-lab/bin/pip install dkimpy dnspython aiosmtpd
When the Postfix installer asks, choose Local only and give it the name mail.example.com. Lesson 6 explains every setting the lab server uses.
What the boxes mean
- Tip: tricks and best practices.
- Watch out: common mistakes and things that cause trouble in production.
- Why it matters: the reason behind a rule, so you can apply it to cases the course doesn’t cover.
- Lab: hands-on practice. Type and run everything yourself.
- Interview question: common interview questions with short answers.
- Self-check: at the end of every lesson.
At the end of the course you’ll find a cheat sheet with ports, DNS record templates and reply codes, the RFCs worth knowing, a 50-question final exam with answers, a complete checklist and a roadmap for what to learn next.
Syllabus
19 lessons · 6 partsDay 1 · How email works
The whole journey of a message, the jobs of the servers it passes through, the message format and MIME, SMTP as a conversation you can type by hand, and how mail apps read mail with IMAP, POP3 and JMAP.
- 01How email works: the journey of one message, step by stepHow email works from send to inbox: MUA, MSA, MTA and MDA, MX lookups, the SMTP envelope vs the headers, ports 25, 587, 465 and 993, queues and retries.
- 02Anatomy of an email: headers, MIME, encodings and attachmentsWhat a raw email looks like: RFC 5322 headers, Received chains, Message-ID, MIME multipart trees, base64, quoted-printable, encoded-words, attachments.
- 03SMTP explained: commands, reply codes, STARTTLS and bouncesSMTP typed by hand against a real Postfix server: EHLO, MAIL FROM, RCPT TO, DATA, extensions, STARTTLS, AUTH, reply codes, queues, bounces, open relays.
- 04IMAP, POP3 and JMAP: how mail apps read your mailboxHow mail apps read mail: IMAP folders, flags, UIDs and IDLE typed by hand, POP3, JMAP, Exchange and Graph, OAuth and app passwords, autodiscover.
Day 2 · DNS, mail servers & hosting
The DNS records email depends on (MX, PTR, null MX, SRV and TXT), building a real mail server with Postfix and Dovecot, then the hosted alternative: Google Workspace and Microsoft 365, and how to migrate a domain between providers safely.
- 05DNS for email: MX, PTR, null MX and every record a mail domain needsThe DNS records email depends on: MX priorities and fallback, A/AAAA, PTR and FCrDNS, null MX, SRV, TXT rules, and locking down domains that never send.
- 06Build a mail server with Postfix and Dovecot, and should you?Run your own mail server: how Postfix and Dovecot fit together, main.cf and master.cf, LMTP, TLS, anti-relay rules, queues and logs, and when to self-host.
- 07Google Workspace and Microsoft 365 email: setup, relays and migrationSet up a domain on Google Workspace or Microsoft 365: verification, MX, SPF, DKIM and DMARC, sending from printers and apps, and a safe migration plan.
Day 3 · Sender authentication
How a receiver decides whether a message really comes from your domain: SPF, DKIM and DMARC in depth, then the protocols that fix their gaps: SRS and ARC for forwarding, MTA-STS, TLS-RPT and DANE for transport security, and BIMI for your logo in the inbox.
- 08SPF explained: syntax, the 10-lookup limit and common mistakesHow SPF works: what it checks and what it doesn't, mechanisms and qualifiers, ~all vs -all, the 10-lookup limit, why forwarding breaks it, with a lab.
- 09DKIM explained: how email signatures work, with a signing labHow DKIM signs email: the DKIM-Signature header tag by tag, selectors and keys in DNS, canonicalization, what breaks signatures, key rotation, and a lab.
- 10DMARC explained: alignment, policies, RFC 9989 and reading reportsHow DMARC protects your From address: SPF and DKIM alignment, p=none to reject, what RFC 9989 changed, a safe rollout plan, and reading aggregate reports.
- 11SRS, ARC, MTA-STS, TLS-RPT, DANE and BIMI explainedBeyond SPF, DKIM and DMARC: SRS and ARC for forwarding, MTA-STS, TLS-RPT and DANE to enforce TLS between servers, and BIMI for your logo in the inbox.
Day 4 · Deliverability & spam
How spam filters decide, every common reason good mail ends up in spam and how to fix each one, what Gmail, Yahoo and Microsoft require from senders, sending at volume without losing your reputation, and a systematic way to troubleshoot any delivery problem.
- 12Why emails go to spam: every common cause and how to fix itWhy legitimate email lands in spam: how Gmail, Microsoft and other filters decide, and every common cause with its fix, from authentication to lists.
- 13Email deliverability: sender requirements, warm-up and list hygieneStaying in the inbox at volume: Gmail, Yahoo and Outlook.com sender requirements, one-click unsubscribe, IP and domain warm-up, list hygiene, the law.
- 14Email troubleshooting: reading headers, bounce codes and a playbookA method for any email problem: split the path, read headers and Authentication-Results, decode Gmail and Microsoft bounce codes, and trace logs.
Day 5 · HTML email, images, code & security
Building HTML email that renders everywhere and adding images the right way, sending email from application code, defending against spoofing, phishing and BEC, and running email for an organization day to day.
- 15HTML email and images: how to build emails and embed images properlyBuild HTML email that renders in Gmail, Outlook and Apple Mail, and every way to add images: hosted, CID, data URIs, retina, alt text and dark mode.
- 16Sending email from code: SMTP vs API, queues, retries and webhooksHow applications should send email: SMTP or an ESP API, Python and Node.js examples, queues and retries, bounce webhooks, headers, security and testing.
- 17Email security: phishing, spoofing, BEC, S/MIME and account protectionDefending an organization by email: spoofing, lookalike domains, phishing and BEC, layered defenses, compromised mailboxes, S/MIME and PGP, with a lab.
- 18Email administration: mailboxes, retention, offboarding and monitoringRunning email day to day: mailbox types and role addresses, onboarding and offboarding, retention, archiving and legal hold, backups, and monitoring.
Wrap-up
Ports, DNS record templates, reply codes, the RFCs worth knowing, a 50-question final exam with answers, a complete checklist and where to go next.