Extract Email Addresses from Maildir

Extract email addresses from Maildir. Notepad, a Python script and a Windows tool with real steps.

By · Published 30 Jul 2024 · Updated 13 Oct 2026 · 7 min read

How to Extract Email Addresses From Maildir Format?

Quick answer

Maildir stores every message as its own file inside folders, so one mailbox can hold thousands of files and no export button for addresses. Opening files one at a time to copy email addresses from Maildir takes days and misses addresses inside attachments. Below are three ways to extract email addresses from Maildir, with real steps, a working script and fixes for missing addresses.

How does Maildir store email addresses?

Maildir keeps one message per file and one mail folder per directory. Under Bernstein's Maildir specification, a mailbox has three subfolders named tmp, new and cur. Fresh mail lands in new and read mail moves to cur. Message files have no extension, and addresses sit in header lines such as From, To, Cc and Reply-To. Body text and attachments can hold more.

To extract email addresses from Maildir in full, a method must read message files in cur and new for every folder, plus body text and attachments. Mail servers like Dovecot and qmail use Maildir, and many Linux mail setups keep a Maildir folder in a home directory. Read Bernstein's Maildir specification for full layout rules.

How to extract email addresses from Maildir manually?

Open Maildir message files in Notepad and copy addresses from header lines. Manual copying of Maildir email addresses works for a few messages and fails at scale, since every message is a separate file.

  1. Open your Maildir folder, then open cur or new.
  2. Right-click a message file, select Open with and then Notepad.
  3. Find lines that start with From:, To: and Cc: near top of file.
  4. Copy email addresses from those header lines. A real address sits between < and > symbols.
  5. Press Ctrl+F and search for @ to spot addresses in body text.
  6. Paste addresses into a text file, one per line, then repeat for every message and every subfolder.
  7. Open your list in Excel and select Data, then Remove Duplicates.

Subfolders hide inside directories that start with a dot, such as .Sent, so check hidden folders too. Attachment addresses stay hidden unless you open every attachment separately.

How to extract email addresses from Maildir with Python?

A short Python script extracts email addresses from Maildir folders in one pass. It uses Python's built-in email package, so you install nothing extra. It walks every cur and new folder, reads From, To, Cc, Bcc and Reply-To headers, lowercases addresses and drops duplicates.

  1. Install Python 3 on your PC and save script below as extract_maildir.py.
  2. Open Command Prompt in your script folder.
  3. Type python extract_maildir.py C:\Maildir addresses.txt, replacing C:\Maildir with your Maildir path.
  4. Open addresses.txt and check your list.
import sys, os
from email import policy
from email.parser import BytesParser
from email.utils import getaddresses

root, outfile = sys.argv[1], sys.argv[2]
found = set()
for folder, dirs, files in os.walk(root):
    if os.path.basename(folder) not in ("cur", "new"):
        continue
    for name in files:
        with open(os.path.join(folder, name), "rb") as f:
            msg = BytesParser(policy=policy.default).parse(f)
        for field in ("From", "To", "Cc", "Bcc", "Reply-To"):
            for _, addr in getaddresses(msg.get_all(field, [])):
                if addr:
                    found.add(addr.lower())
with open(outfile, "w") as out:
    out.write("\n".join(sorted(found)))
print(len(found), "addresses saved to", outfile)

That script handles subfolders such as .Sent and display names with commas, like "Carl, D" <carl@example.net>. It does not read body text or attachments, so addresses inside them stay behind, and it cannot filter by date or sender. Read Python's email package documentation to extend it.

Bulk method with free demo

How to extract Maildir email addresses in bulk with software?

Use Corbett Email Address Extractor to extract email addresses from Maildir without scripts. Its page says it searches From, To, Cc, Subject, Message Body and Message Header fields, reads PDF and Word attachments, shows a total count and saves a TXT list. Free demo works on 10 items.

Download Now Purchase Now

Steps to extract email addresses from Maildir with software

  1. Install Corbett Email Address Extractor on your Windows PC and start setup with Run as Administrator.
  2. Select Open in header section, then Email Data Files and Maildir Files.
  3. Browse to your Maildir folder and load it for extraction.
  4. Preview your messages. Untick folders you do not need, such as junk. Greyed out folders can stay skipped.
  5. Select Extract at top of window, then Email Addresses.
  6. Tick fields that should supply addresses: From, To, Cc, Subject, Message Body, Message Header or attachments.
  7. Add date, sender or file type filters if you need a shorter list.
  8. Browse to a destination folder and select Save. Your addresses land in a TXT file that opens in Notepad.

Check your count of Maildir email addresses in results pane before you save, test on a small folder and then buy. Lifetime licence starts at $99 with a 30-day money-back window. Software works on Windows 10 and older editions with 100 MB of free disk space. To pull addresses from other formats, read how to extract email addresses from EML files and how to extract email addresses from MBOX files.

Which way to extract email addresses from Maildir is best?

Use Notepad for a handful of messages and Python for header addresses in one Maildir folder. Use software to extract email addresses from Maildir when addresses hide in body text or attachments, or when you need filters.

Way to extract Maildir email addressesCostReads body and attachmentsFiltersBest for
Notepad and copyFreeBody by search, attachments by handNoneA few messages
Python scriptFreeNoNoneHeader addresses in one Maildir
Corbett Email Address ExtractorFree demo, then from $99YesDate, sender, receiver, subject, file typeBig mailboxes

Why are email addresses missing after extraction?

Missing addresses come from four causes when you extract email addresses from Maildir. A script that reads headers only skips addresses in body text and attachments. Hidden subfolders that start with a dot stay out unless your method walks them. Filters and unticked folders narrow your list. Duplicates collapse into one line, so your count looks lower than your message count.

Check folders first, then fields, then filters when Maildir email addresses go missing. Other formats follow a similar pattern. See how to extract email addresses from Thunderbird and how to extract email addresses from an OLM file.

Where do you find a Maildir folder?

Mail servers like Dovecot and qmail keep Maildir folders inside user home directories. Hosting panels and Linux mail setups use identical layout. Copy that folder to your Windows PC before you extract. To move Maildir mail into Outlook instead, read how to convert Maildir to PST. For Maildir backup steps, see Maildir backup software.

Key takeaways

Questions about extracting email addresses from Maildir

How do I extract email addresses from Maildir?

Open message files in Notepad and copy header addresses, execute a Python script on your Maildir folder or load it in software that saves a TXT list in bulk.

What is a Maildir folder?

A mailbox format where every message is its own file and every mail folder is a directory with tmp, new and cur subfolders.

Can I extract email addresses from Maildir for free?

Yes. Notepad and a Python script extract email addresses from Maildir free. Software adds body, attachment and filter support.

Why do Maildir message files have no extension?

Maildir names files with unique IDs instead of extensions. Open them in Notepad or read them with a script or software.

Does Python read addresses in message body text?

Not in script above. It reads header fields only. You need extra code or software for body text.

Can software extract addresses from Maildir attachments?

Yes. Corbett's page says its attachment option reads PDF, Word and other files and stores addresses in a TXT file.

Can I extract addresses from one sender only?

Yes. Software filters by From, To, Cc, Subject, Message Body or Message Header. A tick box beside every field turns on selective retrieval.

How many addresses does free demo extract?

Free demo works on 10 items. Full edition lifts that cap.

What file type holds my extracted list?

A TXT file. It opens in Notepad or Notepad++ and pastes into Excel.

Which Windows versions does software need?

Corbett's page lists Windows 10 in 32-bit or 64-bit plus older editions. There is no Mac or Linux build.

Free demo

Need to Extract Email Addresses from Maildir?

Try Corbett Email Address Extractor to extract email addresses from Maildir, starting with a small folder. Free demo works on 10 items, then purchase when your list looks right.

Download Now Purchase Now

Jared Young

Jared is an engineering graduate in Computer Science who specializes in data recovery and backup. He writes Corbett Software guides on email attachments, backups and mail migration.