Skip to main content

Utility for exporting attachments from mbox files

Project description

mboxattachments is a Python class for extracting all embedded files in a group of emails. It was developed to assist in the running of a photography club. Members of the club would regularly send emails containing images to the club secretary. The secretary would manually save the attachments, organize those files, and prepare a show for the members. The manual saving process was time consuming and error prone.

This utility allows downloading all the attachments in a set of emails contained in an mbox file. Conveniently, gmail permits exporting emails as mbox files


On debian and Windows 7 the following is known to work

pip install mboxattachments


mboxattachments --exportpath  images  emails.mbox


mboxattachments --filter_from flur  --exportpath images emails.mbox

The above line will test all email messages in the file emails.mbox to see the the senders name (FROM field) matches the regular expression flur. If an mail matches, all of its attachments will be written to a file in the directory images.

mboxattachments --SQstart 1000  --exportpath images emails.mbox

The above command will save the attachments from every file in emails.bmox. The file names will be of the form SQ1000…., SQ1001…., SQ1003….


options:   specify output directory
           filter by sender
           filter by recipient
           filter by date
           specify destination diretory for attachments
           set sequence number field starting value (default 0)

 mboxattachments [--help] [--version] [--debug] [--filter_from regexp]
                 [--filter_to regexp] [--filter_date regexp]
                 [--exportpath path] [--SQstart value]  input_mbox_file ...

attachments are stored as separate files
file names are of the form
<sequence number>-<email subject>-<email sender>-<file name of attachment>
  for example, a possible file name is
  SQ0146-CellPhone -
  ------ ------------------ ----------------- -------------------
  seqnum    email subject     sender           file name in email

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mboxattachments, version 0.5.35
Filename, size File type Python version Upload date Hashes
Filename, size mboxattachments-0.5.35.tar.gz (8.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page