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!

Read an email from stdin and forward it to a url

Project Description


smtp2zope is a script that takes an email as input, does some transformation, and submits it to a backend server using a url. Traditionally, Zope is expected to be the receiving server, hence the name, but should work fine for other servers too.

Originally, the code here comes from the MailBoxer product for Zope.


When installing this package, a smtp2zope script is generated. The script reads from standard input and expects a url and optional maximum number of bytes as arguments:

smtp2zope URL [MAXBYTES]


call this URL with the email as a post-request. Authentication can be included in URL:


optional: only forward mails with a size of less than MAXBYTES to the URL

So a test run could look like this:

cat testmail.txt > /path/to/smtp2zope

Mail server integration

Mail comes in through a mail server. So when you want mail for to be handled by smtp2zope and sent to your web server, you should add an alias in your smtp server configuration. Something like this probably works (there might be slight differences depending on which mail server you use): "|/path/to/smtp2zope 1000000"

The number at the end restricts the maximum size of a message; this is optional, but highly recommended.


Please note: output is logged to maillog per default on unices. See your maillog (e.g. /var/log/mail.log) to debug problems with the setup.


If you like setting up your project with zc.buildout (I myself do), this simple snippet is enough to create the bin/smtp2zope script:

recipe = zc.recipe.egg
eggs = smtp2zope


  • Original implementation: Maik Jablonski
  • Packaging: Maurits van Rees


1.2 (2012-10-14)

1.1 (2011-05-05)

  • Use a better way to determine the basic authentication information that is passed in the url so the logic does not fail when the url has an @ sign somewhere else. [maurits]
  • Fixed error “local variable ‘AUTHORIZATION’ referenced before assignment” when not using basic authentication ( [maurits]

1.0 (2011-05-04)

  • Initial release

Release History

This version
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
(27.2 kB) Copy SHA256 Hash SHA256
Source None Oct 14, 2012

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 DreamHost DreamHost Log Hosting