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.
- Open your Maildir folder, then open
curornew. - Right-click a message file, select Open with and then Notepad.
- Find lines that start with
From:,To:andCc:near top of file. - Copy email addresses from those header lines. A real address sits between < and > symbols.
- Press Ctrl+F and search for
@to spot addresses in body text. - Paste addresses into a text file, one per line, then repeat for every message and every subfolder.
- 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.
- Install Python 3 on your PC and save script below as
extract_maildir.py. - Open Command Prompt in your script folder.
- Type
python extract_maildir.py C:\Maildir addresses.txt, replacingC:\Maildirwith your Maildir path. - Open
addresses.txtand 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.
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.
Steps to pull addresses from Maildir with software
- Install Corbett Email Address Extractor on your Windows PC and start setup with Run as Administrator.
- Select Open in header section, then Email Data Files and Maildir Files.
- Browse to your Maildir folder and open it for extraction.
- Preview your messages. Untick folders you do not need, like junk. Greyed out folders can remain ignored.
- Select Extract at top of window, then Email Addresses.
- Tick fields that should supply addresses: From, To, Cc, Subject, Message Body, Message Header or attachments.
- Add date, sender or file type filters if you need a shorter list.
- 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 addresses | Cost | Reads body and attachments | Filters | Suits |
|---|---|---|---|---|
| Notepad and copy | Free | Body by search, attachments by hand | None | A few messages |
| Python script | Free | No | None | Header addresses in one Maildir |
| Corbett Email Address Extractor | Free demo, then from $99 | Yes | Date, sender, receiver, subject, file type | Big 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
- Maildir retains one message per file, with mail in
curandnewfolders. - Notepad works for a few messages but you copy addresses by hand and remove duplicates yourself.
- A Python script saves unique header addresses from a Maildir free. It ignores body text and attachments.
- Corbett Email Address Extractor scans headers, body text and attachments, shows a count and saves a TXT list. Free demo works on 10 items.
- Check hidden subfolders and clear filters when your list of Maildir email addresses looks short.
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.