Ever Wondered What Actually Happens When You Click “Send” on an Email?

Published: (May 27, 2026 at 05:28 AM EDT)
7 min read
Source: Dev.to

Source: Dev.to

A quick message to a friend.
An internship application.
A password reset request.
A late‑night “Please find attached” email.

And honestly, for most of us, sending an email feels incredibly simple:

  1. Open Gmail
  2. Write the message
  3. Add the recipient

Click SendDone

But have you ever stopped and wondered:

“What actually happens after I click that Send button?”

How does your email travel across the world in just a few seconds?
How does Gmail know you’re the real sender?
How does Yahoo trust that the email genuinely came from Gmail and not from a hacker pretending to be you?

Behind that tiny Send button is an entire backend ecosystem quietly working in milliseconds.
And trust me — it’s way more interesting than it looks.


Let’s Take a Real Example

Suppose I send an email from:

diksha@gmail.com

to:

tom@yahoo.com

From my perspective, I just typed a message and clicked Send.
In reality, multiple systems, protocols, security checks, DNS servers, and mail servers immediately start working behind the scenes.

Let’s break down the complete journey of that email.

Step 1 — Gmail First Verifies Me

Before Gmail even sends my email, Google already knows who I am because I logged into my Gmail account earlier. When I signed in, Google verified:

  • my username and password
  • session tokens
  • authentication status

So when I hit Send, Gmail already knows:

Yes, this is actually Diksha.

This is important because otherwise anyone could pretend to be me and send emails from my address.

Step 2 — Gmail’s SMTP Server Takes Over

The moment I press Send, Gmail hands my email to its SMTP server:

smtp.gmail.com

SMTP stands for Simple Mail Transfer Protocol – think of it as the internet’s digital post office. Its job is to:

  • send emails
  • route emails
  • relay emails between mail servers

At this point, Gmail starts preparing my email for delivery.

Step 3 — Hidden Email Headers Are Added

Gmail secretly adds metadata to the email, such as:

  • sender address
  • receiver address
  • timestamps
  • routing information
  • message identifiers

For example:

From: diksha@gmail.com
To:   tom@yahoo.com

These headers help mail servers understand where the email came from, where it should go, and how it should be processed.

Step 4 — Gmail Digitally Signs the Email

Now comes one of the coolest parts: Gmail adds a DKIM Signature.

DKIM (DomainKeys Identified Mail) is a digital signature created with cryptography. Imagine Google placing an official tamper‑proof stamp on the email saying, “Yes, this email genuinely came from us.”

The signature proves:

  • the email is authentic
  • the message wasn’t modified during transit

If even a single word changes while traveling across the internet, the signature breaks.

Step 5 — Gmail Needs to Find Yahoo’s Mail Server

Gmail looks at the recipient address:

tom@yahoo.com

and extracts the domain:

yahoo.com

Computers, however, need an IP address, not a human‑readable name. So Gmail performs a DNS lookup.

Step 6 — DNS and MX Records Come Into Play

DNS is the internet’s phonebook. Gmail asks DNS:

“Which mail server handles emails for yahoo.com?”

DNS checks the domain’s MX (Mail Exchange) records and replies with Yahoo’s mail server details, e.g.:

yahoo.com.   MX 10 mta5.am0.yahoodns.net.

That line means “Send Yahoo emails here.” Now Gmail knows exactly where to deliver the message.

Step 7 — The Email Travels Across the Internet

The actual journey begins:

  • The email is broken into packets.
  • Packets travel through routers, ISPs, and networks.
  • They cross multiple systems—all within seconds.

Eventually, the packets arrive at Yahoo’s mail server.

But Yahoo does NOT blindly trust the email. This is where cybersecurity becomes crucial.

Step 8 — Yahoo Starts Verifying the Email

Yahoo asks, “Did this email really come from Gmail?” Attackers constantly try to:

  • spoof emails
  • send phishing messages
  • impersonate trusted domains

So Yahoo performs several security checks.

SPF Verification

First, Yahoo checks SPF (Sender Policy Framework). SPF tells Yahoo:

“Which servers are allowed to send emails for gmail.com?”

Yahoo looks up Gmail’s SPF record in DNS. If the sending server (smtp.gmail.com) is authorized, the result is SPF PASS; otherwise, SPF FAIL. This helps prevent fake mail servers from impersonating Gmail.

DKIM Verification

Next, Yahoo verifies the DKIM signature added earlier:

  1. Retrieves Gmail’s public key from DNS.
  2. Validates the signature against the email’s content.

If the signature matches, the result is DKIM PASS; if the message was tampered with, it’s DKIM FAIL. This ensures email integrity.

DMARC — The Final Decision Maker

Finally, Yahoo checks DMARC (Domain‑Based Message Authentication, Reporting & Conformance). DMARC ties SPF and DKIM together and tells Yahoo what to do when either check fails (e.g., reject, quarantine, or accept the message).

If both SPF and DKIM pass and align with the domain’s DMARC policy, Yahoo delivers the email to Tom’s inbox. If not, the email may be rejected or sent to spam.

Recap

  1. Authentication – Gmail confirms you are who you claim to be.
  2. SMTP – Gmail hands the message to its mail server.
  3. Headers – Metadata is attached for routing.
  4. DKIM – A cryptographic signature is added.
  5. DNS Lookup – Gmail discovers Yahoo’s MX record.
  6. Transmission – The message travels as packets across the internet.
  7. SPF/DKIM/DMARC – Yahoo validates the sender and integrity.
  8. Delivery – The email lands in the recipient’s inbox (or spam folder).

That tiny Send button triggers a sophisticated, multi‑layered process that keeps our daily communications fast, reliable, and secure. 🚀

DMARC Policy Overview

“What should you do if SPF or DKIM fails?”

The DMARC policy can specify one of three actions for unauthenticated mail:

  • allow
  • quarantine
  • reject

Example

v=DMARC1; p=reject

Interpretation: Reject unauthenticated emails.

Sample Promotional Mail

Promotional email screenshot

This is one of the biggest protections against phishing and spoofing today.

Step 9 — Spam and Malware Detection

Even if authentication passes, Yahoo still scans the email for:

  • suspicious links
  • malware attachments
  • phishing keywords
  • sender reputation
  • blacklists
  • spam‑like behavior

Modern email systems also employ:

  • AI‑based spam filtering
  • Behavioral analysis
  • Threat intelligence

to detect malicious messages.

Step 10 — Inbox, Spam, or Rejection

Finally, Yahoo decides the final disposition:

ResultAction
TrustedInbox
SuspiciousSpam
DangerousRejected

Only after passing all these checks does the email finally appear inside Tom’s inbox.

But Wait… How Does Tom Read the Email?

Now Tom opens Yahoo Mail. At this stage either IMAP or POP3 comes into the picture.

IMAP vs. POP3

IMAP

  • Keeps emails synchronized across devices.
  • If Tom reads the email on a laptop, phone, or tablet, everything stays in sync.

POP3

  • Downloads emails locally to a single device.
  • Was more common on older systems.
  • Today, IMAP is far more prevalent.

The Most Interesting Part

All of this happens in just a few seconds. What feels like a simple “Send” button actually involves:

  • Cryptography
  • DNS infrastructure
  • Server‑to‑server communication
  • Authentication
  • Threat detection
  • Internet routing
  • Mailbox synchronization

working together silently in the background.

And honestly, once you understand how email works, you’ll never look at your inbox the same way again.

0 views
Back to Blog

Related posts

Read more »