Quick Answer
Extract attachments from MBOX files in 3 ways. Use add-ons, a Python script or MBOX attachment extractor software.
Add-ons suit a few files and need Thunderbird. Script suits one folder of named files. Software opens MBOX files and filters by date or size.
Test one MBOX file before you do the rest.
MBOX files retain every message and its attachments as one text file so you cannot open it and grab your PDFs. Windows has no built-in way to save MBOX attachments and saving them one by one from a mail app takes hours. Below are three ways to save MBOX attachments, with real steps, a working script and fixes for missing files.
Do MBOX files contain attachments?
Yes. MBOX files store messages in plain text, one after another and attachments sit inside messages as encoded text. Thunderbird, Apple Mail and Eudora use that format and Google Takeout exports Gmail as MBOX. To extract attachments from MBOX files, a tool must open every message and decode attachments back into original files.
When you save MBOX attachments, you retain backup copies of your files. Large MBOX files with big attachments are harder to open and move around.
How to extract attachments from MBOX files in Thunderbird?
Thunderbird can extract MBOX attachments with two free add-ons. ImportExportTools NG opens your MBOX file into Local Folders. AttachmentExtractor Continued then saves attachments from selected messages. Add-on pages list supported Thunderbird versions so check yours before you install.
- Open Thunderbird, select your menu icon and choose Add-ons and Themes.
- Search for ImportExportTools NG and AttachmentExtractor Continued. Select Add to Thunderbird for both, then select Add.
- Right-click Local Folders, hover over ImportExportTools NG and then Import mbox Files. Select Individual mbox Files.
- Browse to your MBOX file, select it and choose Open. Your messages appear under Local Folders.
- Right-click your imported folder and select Extract All Attachments to, then choose Browse.
- Select a destination folder to save every attachment from your MBOX files.
You retain your MBOX file where it is, since Thunderbird copies messages into Local Folders. HKU SPACE IT support lists that menu path. If a folder contain thousands of messages, give Thunderbird a few minutes to finish before you extract. One Thunderbird user on Mozilla Support wanted every attachment in one place and found that saving by hand asked for a folder every time and prompted on duplicate names. A helper suggested Filtaquilla add-on and that user said it worked "in a way" but not perfectly. To save attachments from a live Thunderbird mailbox, see how to Download attachments from Thunderbird.
How to save MBOX attachments with Python?
A short Python script can save MBOX attachments without any mail app. It uses Python's built-in mailbox module so you install nothing extra. It saves every part that carries a file name and renames duplicates as name(1).ext.
- Install Python 3 on your PC and save script below as
extract.py. - Open Command Prompt in your script folder.
- Enter
python extract.py mail.mbox attachments, replacingmail.mboxwith your file name. - Open your new
attachmentsfolder and check your MBOX attachments.
import mailbox, os, re, sys
src, out = sys.argv[1], sys.argv[2]
os.makedirs(out, exist_ok=True)
count = 0
for msg in mailbox.mbox(src):
for part in msg.walk():
name = part.get_filename()
if not name:
continue
data = part.get_payload(decode=True)
if data is None:
continue
name = re.sub(r'[\\/:*?"<>|]', '_', name)
path = os.path.join(out, name)
base, ext = os.path.splitext(name)
n = 1
while os.path.exists(path):
path = os.path.join(out, f"{base}({n}){ext}")
n += 1
with open(path, 'wb') as f:
f.write(data)
count += 1
print(count, "attachments saved to", out)
That script ignores parts without a file name so some inline pictures remain behind. It also retains no message dates or folder names and it cannot filter by sender. Scan extracted MBOX attachments with antivirus software before you open them. Python's mailbox docs describe that module in full.
How to extract MBOX attachments in bulk with software?
Use Corbett Email Attachment Extractor to save attachments from MBOX files without Thunderbird. Its page says it saves files in their original format with no data loss, takes inline attachments and renames duplicate names as File(1). Filters include date, sender, receiver, subject, file name and file size. Free demo extracts 10 attachments per folder.
Steps to save MBOX attachments with software
- Install Corbett Email Attachment Extractor on your Windows PC and open it with Run as administrator.
- Select Open, then Email Data Files and MBOX Files.
- Choose a mode. Choose Files opens one MBOX file and Choose Folders opens a batch.
- Preview your messages. Folder tick boxes start ticked so untick folders you do not need.
- Select Extract, then Attachments.
- Set date, sender, subject, file name or file size filters if you need fewer files.
- Browse to a destination folder and select Save. Your MBOX attachments go to a new folder that follows your mail folder layout.
Test a demo on one MBOX file first, check your extracted MBOX attachments and then buy. Lifetime licence starts at $99 with a 30-day money-back window. It works on Windows 10, 8 and 7, needs 100 MB of disk space and retains no email body text. To pull addresses out of MBOX files too, see how to Extract email addresses from MBOX files.
Which way to save MBOX attachments suits you?
Use Thunderbird to extract attachments from small MBOX files and Python if you like scripts. Use software to save MBOX attachments when you need filters, big batches or inline files.
| Way to extract MBOX attachments | Cost | Filters | Needs | Suits |
|---|---|---|---|---|
| Thunderbird with two add-ons | Free | Select messages only | Thunderbird, add-on support | One small file |
| Python script | Free | None | Python 3 | Bulk save |
| Corbett Email Attachment Extractor | Free demo, then from $99 | Date, sender, subject, name, size | Windows PC | Big batches |
Why are MBOX attachments missing after extraction?
Missing MBOX attachments come from three causes when you save MBOX attachments. Inline pictures carry no file name so scripts and some add-ons ignore them. Your add-on can miss support for your Thunderbird version. A large MBOX file may need time to open before extraction starts. Check add-on versions first, then try software that lists inline attachments in its output.
Other mail formats follow a similar pattern. See how to Extract attachments from EML files and how to Extract attachments from a PST file.
Where do you get MBOX files?
Google Takeout exports Gmail as MBOX. Thunderbird retains mail in MBOX-style files in your profile folder and Apple Mail exports mailboxes in it. To create MBOX files first, see how to Export Gmail emails to MBOX or Export MBOX from Thunderbird. To open files before you extract, see how to Open MBOX files.
Our view
Thunderbird add-ons need a version check before install. Python is free and quick but ignores inline pictures. Software fits big archives and filters.
Key takeaways
- MBOX attachments sit as encoded text inside messages so a tool must decode them.
- Thunderbird needs ImportExportTools NG to open MBOX files and an attachment add-on to save files.
- A Python script saves named attachments free but it ignores unnamed inline pictures.
- Corbett Email Attachment Extractor filters by date, sender, subject, file name and size. Free demo extracts 10 attachments per folder.
- Scan extracted MBOX attachments with antivirus software before you open them.
Questions About MBOX Attachments
Do MBOX files include attachments?
Yes. MBOX stores messages and attachments together in one text file, with attachments encoded inside messages.
Which Thunderbird add-ons extract MBOX attachments?
ImportExportTools NG imports your MBOX file and AttachmentExtractor Continued saves attachments from selected messages.
Do I need Python to extract MBOX attachments?
No. Python is one free way. Thunderbird add-ons and Corbett Email Attachment Extractor work without it.
What happens when two attachments share a name?
Corbett's software renames a second file as File(1). Python above renames it as name(1).ext so no file is overwritten.
How do I extract attachments from MBOX files?
Import your MBOX file into Thunderbird and use an attachment add-on, use a Python script or open your file in software that saves attachments in bulk.
Can I save MBOX attachments for free?
Yes. Thunderbird with two add-ons or a Python script saves MBOX attachments free. Software adds filters and batch loading.
Can I save only PDF attachments from MBOX files?
Corbett's page lists a file name filter so test it on demo. Thunderbird add-ons and Python save every named attachment.