Skip to content
Export email messages in a Maildir as CSV file
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This command-line utility converts the contents of a Maildir to a CSV file. Each header becomes a CSV column, and each email becomes a row.

$ mail2csv example/
"Wed, 16 May 2018 20:05:16 +0000",An email,Bob <>
"Wed, 16 May 2018 20:07:52 +0000",Also an email,Alice <>

By default, only Date, Subject and From headers are shown. Use --headers to specify which other headers to include, and --all-headers to include them all.


  • Python 2 or 3.


cp /usr/local/bin/mail2csv

Full usage

usage: [-h] [--outfile OUTFILE] [--headers HEADERS [HEADERS ...]]

Convert maildir to CSV.

positional arguments:
  maildir               Directory to read from

optional arguments:
  -h, --help            show this help message and exit
  --outfile OUTFILE     File to output to. Standard output is used if this is
                        not specified
  --headers HEADERS [HEADERS ...]
                        Headers to include
  --all-headers         Include all headers. Alias for --headers '*'
You can’t perform that action at this time.