Extract Email Addresses from Maildir

Pull 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

Extract email addresses from Maildir in 3 ways. Use Notepad, a Python script or extractor software.

Notepad suits a few messages. Script handles headers in one folder tree. Software scans headers and body text and attachments.

Test a Maildir email address extractor on ten files first.

Maildir stores every message as its own file inside folders so one mailbox can contain 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 pull Maildir addresses, with real steps, a working script and fixes for missing addresses.

How does Maildir store email addresses?

Maildir retains 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 arrives in new and opened mail moves to cur. Message files have no extension and addresses sit in header lines like From, To, Cc and Reply-To. Body text and attachments can contain more.

To pull every address from Maildir, a method must scan 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 store a Maildir folder in a home directory. See Bernstein's Maildir specification for full layout rules.

How to pull 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, like .Sent so check hidden folders too. Attachment addresses remain hidden unless you open every attachment separately.

How to extract email addresses from Maildir with Python?

A short Python script pulls 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, scans 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 like .Sent and display names with commas, like "Carl, D" <carl@example.net>. It does not scan body text or attachments so addresses inside them remain behind and it cannot filter by date or sender. See 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, scans 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 pull 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 open it for extraction.
  4. Preview your messages. Untick folders you do not need, like junk. Greyed out folders can remain ignored.
  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 go to 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, see how to Extract email addresses from EML files and how to Extract email addresses from MBOX files.

Which way to pull Maildir addresses suits you?

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

Way to extract Maildir email addressesCostReads body and attachmentsFiltersSuits
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 pull addresses from Maildir. A script that scans headers only ignores addresses in body text and attachments. Hidden subfolders that start with a dot remain 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 retain 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, see how to Convert Maildir to PST. For Maildir backup steps, see Maildir backup software.

Key takeaways

Questions About Maildir Email Addresses

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.

Why do Maildir message files have no extension?

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

Can software extract addresses from Maildir attachments?

Yes. Corbett's page says its attachment option scans 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 activates selective retrieval.

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 open it in software that saves a TXT list in bulk.

Can I pull Maildir addresses for free?

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

What file type contain my extracted list?

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

Free demo

Need to Pull addresses from Maildir?

Try Corbett Email Address Extractor to pull Maildir addresses, 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 saves Corbett Software guides on email attachments, backups and mail migration.