How to Read and Analyze Email Internet Headers

How to Read and Analyze Email Internet Headers
What Are Email Headers and How to Analyze Them
Email internet headers are hidden blocks of metadata attached to every electronic message, detailing its origin, transmission route, and authentication status. To analyse them safely, you must extract the raw text containing fields like Received, Return-Path, and Authentication-Results, and parse these details to verify sender legitimacy and diagnose delivery failures.
Understanding email headers is essential for cybersecurity professionals and system administrators seeking to identify phishing attempts or troubleshoot deliverability issues. Each header provides a chronological footprint of the message’s journey across the Internet. By inspecting these technical footprints, you can reconstruct the exact path an email took from the sender’s Simple Mail Transfer Protocol (SMTP) server to the recipient’s inbox.
Key Definitions: RFC 5322, SMTP, MIME, Message-ID, Return-Path
To accurately interpret email headers, you must first understand the foundational protocols and identifiers that govern electronic mail transmission. The Internet Engineering Task Force (IETF) defines these standards.
- RFC 5322: The Internet Message Format specifies the syntax for text messages sent between computer users. It dictates that an email consists of headers and a body, separated by a blank line (carriage return and line feed).
- SMTP (Simple Mail Transfer Protocol): The standard protocol for email transmission across the Internet. SMTP servers communicate by exchanging commands and responses, appending specific trace information as the message moves through the network.
- MIME (Multipurpose Internet Mail Extensions): An extension to the original email protocol that allows users to send non-text attachments, such as images, audio, and application files. MIME headers describe how the email body and attachments are structured and encoded.
- Message-ID: A globally unique identifier generated by the sending mail system when the email is first created. It typically resembles a long string of alphanumeric characters followed by the domain of the originating server (e.g.,
<123456789.abc@mail.example.com>). - Return-Path: Often referred to as the bounce address or envelope sender. This header specifies the email address to which delivery status notifications (bounces) should be sent if the message cannot be delivered.
The Difference Between an Email Envelope, Header, and Body
A complete email transaction consists of three distinct components: the envelope, the header, and the body. Conflating these elements is a common error when analysing email legitimacy.
The Envelope is used exclusively by SMTP servers to route the message. It contains the MAIL FROM and RCPT TO commands. The envelope is analogous to the physical envelope of a postal letter; the recipient’s mail client typically never displays these details once the message is delivered. Instead, the final receiving server writes the envelope sender into the Return-Path header.
The Header is the metadata contained within the message itself, directly following the envelope transaction. It includes fields such as From, To, Date, and Subject. These are the details displayed by your email client. Because the header is separate from the envelope, a malicious sender can forge the From address to appear legitimate.
The Body contains the actual content of the message, including text, HTML formatting, and MIME-encoded attachments. Analysing the separation between these three layers is fundamental to detecting spoofing.
Step-by-Step: How to View Raw Email Headers in Gmail, Outlook, and Apple Mail
To begin analysis, you must first extract the raw internet headers from your email client.
Viewing Headers in Gmail (Web Interface)
Gmail makes it straightforward to access the original message source:
- Log into Gmail and open the email you wish to inspect.
- Click the three vertical dots (More menu) located next to the Reply button.
- Select Show original from the dropdown menu.
- A new tab will open displaying a summary of the authentication results alongside a button to Copy to clipboard the complete raw message.
Viewing Headers in Microsoft Outlook (Desktop Client)
In the classic Outlook desktop application for Windows, extracting headers requires accessing the message properties:
- Double-click the email to open it in a standalone window.
- Navigate to the File tab in the top ribbon and select Properties.
- Locate the Internet headers box at the bottom of the Properties dialogue window.
- Click inside the box, press Ctrl+A to select all text, and Ctrl+C to copy the headers.
If you are dealing with saved Microsoft Outlook files, you can utilise an MSG file viewer to inspect both the headers and the payload offline.
Viewing Headers in Apple Mail (macOS)
Apple Mail users can view headers directly within the application window:
- Open the Apple Mail app and select the target email.
- In the top menu bar, click View.
- Select Message, then click All Headers (or use the shortcut Shift-Command-H).
- The header pane above the email body will expand to show all routing and authentication metadata.
Tracing the “Received” Header: How to Track IP Routing Hops
The Received headers are the most critical components for tracking an email’s geographical and topological journey. Every time an SMTP server processes a message, it prepends a new Received header to the top of the message. Therefore, to trace an email from sender to recipient, you must read the Received headers from bottom to top.
A typical Received header reveals several vital data points:
- from: The hostname and IP address the sending server claimed to be, alongside the actual IP address verified by the receiving server. Discrepancies here often indicate spoofing.
- by: The hostname of the server receiving the message.
- with: The protocol used for transmission (e.g., ESMTPS indicates encrypted SMTP).
- id: The internal tracking ID assigned by the receiving server.
- timestamp: The exact date and time the transfer occurred, compliant with RFC 5322 formatting.
By extracting the IP addresses from the earliest (bottom-most) Received headers, you can utilise WHOIS and GeoIP lookups to determine the origin of the message, distinguishing legitimate corporate mail servers from compromised residential networks or known spam botnets.
Email Authentication: How to Read SPF, DKIM, and DMARC Results
Modern email security relies on three interconnected authentication protocols. Mail servers log the results of these checks in the Authentication-Results header.
Sender Policy Framework (SPF)
SPF allows domain owners to publish DNS records specifying which IP addresses are authorised to send mail on their behalf. The Authentication-Results header will display spf=pass if the connecting IP matches the published record.
DomainKeys Identified Mail (DKIM)
DKIM adds a cryptographic signature to the email header (the DKIM-Signature header), ensuring the message content has not been tampered with during transit. A result of dkim=pass confirms cryptographic integrity.
Domain-based Message Authentication, Reporting, and Conformance (DMARC)
DMARC ties SPF and DKIM together by enforcing alignment. It ensures that the domain validated by SPF and/or DKIM matches the domain visible to the end user in the “From” header. A dmarc=pass result means the email is proven to be from the claimed domain owner.
How to Spot a Spoofed Email Address (Header Forgery)
Email spoofing occurs when a malicious actor manipulates headers to masquerade as a trusted entity. Because SMTP inherently lacks verification for the visible “From” address, spotting forgery requires manual inspection of specific header mismatches.
First, compare the visible From: header against the Return-Path:. In legitimate corporate communications, these domains typically match. If the From address says billing@paypal.com but the Return-Path is bounce-1234@random-server-xyz.com, the email is likely forged.
Second, examine the Reply-To: header. Phishers frequently set a legitimate From address but configure the Reply-To header to direct your response to an inbox they control.
Third, check the first Received IP address. If an email claims to be from Microsoft but originates from a dynamic residential IP in another country, it is spoofed. You must rely on the Authentication-Results rather than the visible From address.
Understanding the X-Headers (X-Mailer, X-Spam-Score)
While RFC 5322 defines standard headers, the protocol allows for custom, non-standard headers, traditionally prefixed with “X-“. These headers are added by mail clients, security gateways, and anti-spam appliances for internal tracking and diagnostic purposes.
- X-Mailer / X-Originating-IP: The X-Mailer header identifies the software used to compose the email. If a supposedly corporate email is sent via an obscure bulk mailing script, it warrants suspicion. The X-Originating-IP sometimes reveals the local IP of the sender before it hit the first SMTP relay.
- X-Spam-Score / X-Spam-Status: Security gateways append these headers after evaluating the message payload and routing history. They assign a numerical score; a high score results in the email being flagged.
How to Analyze Email Headers in Your Browser
Parsing raw headers manually is tedious and prone to human error, especially when dealing with complex routing chains involving half a dozen servers. For rapid diagnostics, you can process the raw text using a secure, client-side email header analyzer.
These tools parse the unstructured text block into a human-readable table. They extract all routing hops, calculate the time delay between each server to identify latency bottlenecks, and decode complex Authentication-Results into simple Pass/Fail metrics. To use one, simply copy the complete raw source from your email client and paste it into the analyzer’s text area.
Privacy & Security: Why You Should Never Upload Headers to Third-Party Online Analyzers
When seeking automated tools to parse headers, privacy is paramount. Raw email headers contain highly sensitive personally identifiable information (PII). This includes internal corporate IP addresses, exact software version numbers, internal routing topologies, and the email addresses of both the sender and recipient.
Uploading this data to arbitrary third-party servers presents a severe security risk. Many online tools transmit the pasted headers to their backend servers for processing, storing the data indefinitely. This exposure can provide adversaries with reconnaissance data for spear-phishing campaigns or network intrusion.
Therefore, you must strictly utilise local or client-side analyzers. A client-side tool processes the text using JavaScript directly within your browser. The data never leaves your machine, ensuring compliance with data protection regulations and maintaining corporate confidentiality.
Frequently Asked Questions
What is the most important email header for security?
The Authentication-Results header is the most critical for security, as it contains the cryptographic and DNS-based verification outcomes of SPF, DKIM, and DMARC. It provides authoritative proof of the sender’s identity and message integrity.
Can an email header be completely fake?
While the top-most headers (like To, From, and Subject) can be easily forged, it is impossible for a sender to forge the topmost Received headers appended by your own mail server. Your server will always accurately record the IP address of the machine that delivered the message to it.
How do I find the original sender’s IP address?
Trace the Received headers from top to bottom. The last Received header (chronologically the first one created) typically shows the IP address of the device or server that originated the email.
What does ‘spf=softfail’ mean in an email header?
A softfail result indicates that the sending IP address is not explicitly authorised in the domain’s SPF record, but the domain owner has specified a transitional policy (using the ~all mechanism) rather than a strict rejection.
Why are some email headers hidden by default?
Raw headers contain highly technical, verbose routing metadata that is confusing and irrelevant to the average user. Email clients parse only the necessary fields (From, To, Date, Subject) for display to provide a clean interface.
Does modifying an email subject change the headers?
Modifying the subject line alters the Subject header. Crucially, if the email was signed with DKIM and the Subject header was included in the cryptographic signature, altering the subject will break the DKIM signature, resulting in a dkim=fail result.
What is the difference between Return-Path and Reply-To?
The Return-Path is an envelope header used by mail servers to route automated non-delivery reports (bounces). The Reply-To header is a client-level instruction dictating where responses should be sent when a human user clicks the Reply button.
Sources & Standards
The methodologies and structures detailed in this guide are based upon the foundational specifications published by the Internet Engineering Task Force (IETF):
- IETF RFC 5322: Internet Message Format. This document defines the standard syntax for text messages sent across networks, establishing the strict separation of headers and body.
- IETF RFC 7489: Domain-based Message Authentication, Reporting, and Conformance (DMARC). This specification outlines the mechanisms for utilizing SPF and DKIM to provide domain-level authentication and policy enforcement.