Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Adds the script, which process given emails to proxy them, replacing real email addresses by company's local ones taken from the contrib.auth module.

Project Description



Module provides proxying emails from external addresses to local ones according to ``django.contrib.User`` emails


1. Install emailfilter to your project's environment. If your env should be activated by hand, then create script (````) like this::

export PYTHONPATH=/path/to/settings_dir/:/path/to/project/

echo "$(cat)" | /path/to/env/bin/python /path/to/env/bin/ >> /path/to/logs/mail_route.log 2>&1

2. Add new pipe to ```` script in postfix (by default it should be placed in ``/etc/postfix/``)::

mailproxy unix - n n - - pipe
flags=FR user=user_that_runs_uwsgi_or_project argv=/path/to/
${nexthop} ${user}

3. Then this transport should be used to process mails.

For example you want to process mails to ```` and you are using cdb storage for postfix.
Add this to ``/etc/postfix/transport``:: mailproxy:

Then update cdb map::

postmap cdb:/etc/postfix/transport

4. now you should create ``/path/where/you/place/mail_route_settings/``::

PROJECT_BASE_DIR = '/path/where/project/settings/can/be/imported/'
DJANGO_SETTINGS_MODULE = 'project.settings'


Some django settings are available for configuration:

* ``EMAIL_HOST``, ``EMAIL_PORT`` — host and port used to "forward" emails
* ``EMAIL_SERVER_DOMAINS`` — list of domains that should be checked for mail forwarding. Example::


Not Django settings in file:

* ``SELF_ADDRESS`` — email address of mail_rote. For example if you forwar all emails from somewhwere
to mail_route by bcc`ingthem then you should set ``SELF_ADDRESS`` to bcc address and it will be ignored
when forwarding address(es) is determined
* ``PROJECT_BASE_DIR`` — this directory will be added to PYTHONPATH
* ``DJANGO_SETTINGS_MODULE`` — env variable with same name will be set to value of this setting
* ``LOG_PATH`` — where logs should be saved

Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(20.9 kB) Copy SHA256 Hash SHA256
Dumb Binary any Jul 4, 2014
(9.3 kB) Copy SHA256 Hash SHA256
Source None Jul 4, 2014

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers