How to Examine EML File for Spam, Phishing and Evidence

0:00
0:00
EML file parts and links listed in a text editor

Quick Answer

You can examine EML file content with three methods. Method 1 uses a text editor like Notepad. Method 2 uses a Python script for many files. Method 3 uses a browser tool with no install. Check the sender, the links and the attachment names. Never open an unknown attachment. Hash the original file if you need evidence. Copy your .eml files before you start.

Table of Contents

How Do You Examine EML File Content?

An EML file stores one email message as plain text with its headers, body and attachments inside. Users who examine EML file content want to know who sent it, where its links point and what its attachments are. Users who ask how to analyze EML file data usually start with the sender and the links. The safest way is to look at the file without running anything inside it.

A text editor shows the raw text. A Python script lists the parts, the links and the attachment names. A browser tool previews the message and its attachment list. This guide shows how to check EML file content with all three methods. It then explains how to analyze EML file data for spam and phishing signs and how EML file forensics works.

Users who need the basics of the file first can open the EML file format guide. Users who only need the header lines can follow the guide to view EML header.

Preview Before You Trust It

Open and preview an EML file in your browser before you trust it. No install required.

Inspect Online

Why Do Users Examine EML Files?

  • Unknown sender. You can inspect EML file content from an unknown sender before you open it in a mail app.
  • Spam review. Teams check EML file for spam signs before they add a sender to a block list.
  • Phishing reports. An EML file stores the full message so a security team can investigate EML file evidence in one piece.
  • Legal and audit requests. EML file analysis of the Message-ID and Date fields identifies one message exactly.
  • Attachment safety. You can check the attachment names before you open anything.

What Should You Check in an EML File?

The table shows how to check EML file parts that matter most and the warning sign for every part.

PartWhat To CheckWarning Sign
SenderThe From address and the Return-Path addressThe two addresses use different domains
LinksThe address behind the link textThe link text names one site and the address points to another
AttachmentsThe file namesA double extension like invoice.pdf.exe
BodyThe wording of the messageUrgent language or a request for personal or financial information
AuthenticationThe SPF and DKIM results in the Authentication-Results fieldA failed result
IdentityThe Message-ID and Date fieldsMissing or repeated values

Methods To Examine EML File

Users with one file choose a text editor. Users with a folder of messages choose the script. Users who want a formatted view choose the browser tool.

MethodBest ForNeeds
1 Text editorOne file and a raw viewAny computer
2 Python scriptMany filesPython 3
3 Browser toolA formatted previewA browser

Method 1: Examine EML File in a Text Editor

Users who want to inspect EML file content safely choose this method because a text editor displays the file as plain text and does not run it.

  1. Copy the .eml file and work on the copy.
  2. Right-click the copy and select Open with then Notepad (TextEdit on a Mac).
  3. Look at the top of the file. The From, Return-Path and Subject lines show the sender and the topic.
  4. Scroll down and find the lines that start with Content-Type. Every part of the message starts with one.
  5. Look for filename= to find the attachment names.
  6. Look for href= to find the addresses behind the link text.

HTML messages show their HTML code and attachments appear as long blocks of base64 text. Do not decode or save an attachment you do not trust. Users who need the header fields explained can follow the guide to view EML header.

Method 2: Examine EML File With a Python Script

Users who need EML file analysis for many files choose this method because one command lists the sender, the parts, the attachment names and the links of a message.

  1. Install Python 3 on your computer.
  2. Save the script below as examine.py.
import re
import sys
from email import policy
from email.parser import BytesParser

with open(sys.argv[1], "rb") as f:
    msg = BytesParser(policy=policy.default).parse(f)

print("From:", msg["From"])
print("Return-Path:", msg["Return-Path"])
print("Subject:", msg["Subject"])
print("Parts:")
for part in msg.walk():
    if not part.is_multipart():
        print(" ", part.get_content_type(), part.get_filename() or "")

body = msg.get_body(preferencelist=("html", "plain"))
text = body.get_content() if body else ""
print("Links:")
for url in sorted(set(re.findall(r'https?://[^\s"\'<>]+', text))):
    print(" ", url)
  1. Open a terminal in the same folder and execute python examine.py message.eml.
  2. Look at the output. It shows the From, Return-Path and Subject values, every part with its type and file name and the web addresses found in the body.

The script lists attachment names and opens no attachment. A message with an HTML body prints the link text and the real address together so you can compare them. Run the script on a copy of the file.

Method 3: Examine EML File in a Browser Tool

Users who want to check EML file content in a formatted preview choose this method. EML Reader opens EML files in any modern browser on Windows, Mac and Linux with no install.

  1. Open the tool in your browser.
  2. Select Drag and Drop Files Here and choose the EML files from your storage.
  3. Click Preview Message.
  4. Scroll down to the message list and open a message.

You see the headers, the formatted body, the inline images and the attachment list. Compare the sender, the links and the attachment names with the table above. The attachment list is also how to analyze EML file attachments before you open them. According to its privacy page the tool processes files in your browser and does not upload them to its servers.

Check Parts in Your Browser

Preview the headers, body and attachment list of an EML file in your browser. No install required.

Open Preview

How Do You Check EML File for Spam and Phishing?

According to CISA, common phishing signs include urgent or emotional language, requests for personal or financial information, shortened links from untrusted sources and sender addresses or links with small misspellings of real companies. Use the methods above to check EML file for spam and to analyze EML file links for phishing signs.

  • Sender mismatch. Compare the From address with the Return-Path address. Two different domains need a closer look.
  • Link mismatch. Compare the link text with the address behind it. A link that names one site and points to another is a warning sign.
  • Attachment names. A double extension like invoice.pdf.exe is a warning sign.
  • Authentication results. A failed SPF or DKIM result in the Authentication-Results field is a warning sign. According to RFC 8601, the field has no integrity protection of its own, so trust it only when your own receiving server added it. Users who need these lines explained can follow the guide to view EML header.
  • Next step. According to CISA, do not reply, open attachments or click any link in a suspicious message, including unsubscribe links. Report it with the report option or the spam button in your email app.

No single sign proves that a message is spam or phishing. Several signs together justify a report.

How Do You Examine EML File Data for Forensic Evidence?

EML file analysis for evidence needs proof that the file did not change after you received it. EML file forensics treats a hash as that proof. A SHA-256 hash is a fixed fingerprint of the file, and any edit to the file produces a different value.

  1. Copy the original .eml file to a separate folder and do not open the original again.
  2. Open a terminal in that folder and execute the line below. Replace message.eml with the file name.
python -c "import hashlib,sys;print(hashlib.sha256(open(sys.argv[1],'rb').read()).hexdigest())" message.eml
  1. Save the hash in a note with the date and time.
  2. Work only on a copy of the file with Method 1, 2 or 3.
  3. Note the Message-ID and Date fields. According to RFC 5322, the Message-ID is a globally unique identifier for one message.
  4. Execute the hash line again at the end. The same hash shows that the original file did not change.

This page does not replace a specialist in EML file forensics. Ask a specialist to investigate EML file evidence before you present it in court.

What Problems Can Appear When You Examine EML File Content?

  • File opens blank in Chrome. Chrome shows an empty page for an .eml file. Use a text editor or follow the guide to open EML file in Chrome browser.
  • File will not open in Outlook. Follow the guide for an EML file not opening in Outlook or use Method 1.
  • Body looks like random characters. The body uses base64 encoding. The Python script in Method 2 decodes it.
  • Attachment names are not clear. Users who need the files can follow the guide to extract attachments from EML files and open them only after a security check.
  • Many files to investigate. Users who need to investigate EML file batches can run the Python script in Method 2 on every copy.

Conclusion

People struggle to examine EML file content because a mail app opens the message and its attachments at once. A text editor shows the raw text. A Python script lists the parts and a browser tool previews the message with no install. Check the sender, the links and the attachment names and hash the original file if you need evidence. Users who know how to check EML file content and how to analyze EML file data catch spam and phishing signs early.

Frequently Asked Questions

Is It Safe To Examine an EML File in a Text Editor?

Yes. A text editor displays the file as plain text and does not run scripts or attachments.

Can an EML File Contain a Virus?

Yes through an attachment. The message text does not run on its own but an attachment can contain harmful code when you open it.

Can You Check EML File Content Without Opening the Attachments?

Yes. All three methods list the attachment names and do not open the attachments.

Does an EML File Show the Real Sender?

Not by itself. The sender writes the From field, so compare it with the Return-Path address and the authentication results.

Can You Prove a Message Is Phishing From the File Alone?

No. The file shows warning signs. Report the message with the report option in your email app and let the security team decide.

Why Should You Hash a File Before EML File Analysis?

A hash is a fingerprint of the file. The same hash after your work shows that the original did not change.

Can You Inspect EML File Data Without Altering It?

Yes, when you open a copy and do not save it. Opening a file only displays it.