skip to navigation
skip to content

Not Logged In

sanson 0.1.2

Remove unwanted headers from email messages stored as plain text

Sanson is a program for removing unwanted headers from email messages stored as plain text, such as in the Maildir format. It was initially written to reduce the size of mail archives by stripping lengthy headers such as DKIM signatures. Sanson is implemented in Python, has no external dependencies, and is tested with Python 2.7.


To install the latest release from PyPI, use pip:

$ pip install sanson

Append --user to install to your home directory instead of a system directory.


Any headers in a message not present in a user specified whitelist, matched case insensitively, are removed from the message and the message file overwritten with the stripped version. The whitelist can be specified with the --whitelist argument. If the whitelist is not specified, Sanson will use the first of $PWD/sansonrc, $XDG_CONFIG_HOME/sansonrc or $HOME/.sansonrc which can be read. The whitelist format is one header per line, with the # character denoting end of line comments. Note that the Date and From headers are required by RFC 2822 and will not be removed even if not whitelisted. If the --verbose argument is given, headers will be printed as they are removed. If the --pretend argument is given, headers which would be removed are printed but the message file is not altered. To view all possible arguments, run

$ sanson --help

It is strongly recommended to backup your data before running Sanson, in case of bugs or missing entries in your whitelist.

Bug reports and patches are welcome either on the issue tracker or by email.


Copyright © 2014 Scott Stevenson.

Sanson is distributed under the terms of the GNU General Public License version 3, or (at your option) any later version. See LICENCE for details.

The example messages in test_data are taken from the Python 2.7 source distribution, and are distributed under the Python Software Foundation License version 2.

File Type Py Version Uploaded on Size
sanson-0.1.2.tar.gz (md5, pgp) Source 2014-02-22 37KB
  • Downloads (All Versions):
  • 12 downloads in the last day
  • 66 downloads in the last week
  • 344 downloads in the last month