Provides central depot for incoming mail for use by applications.

## Project description

repoze.postoffice provides a centralized depot for collecting incoming email for consumption by multiple applications. Incoming mail is sorted into queues according to rules with the expectation that each application will then consume its own queue. Each queue is a first-in-first-out (FIFO) queue, so messages are processed in the order received.

ZODB is used for storage and is also used to provide the client interface. repoze.postoffice clients create a ZODB connection and manipulate models. This makes consuming the message queue in the context of a transaction, relatively simple.

Please see docs/index.rst for the complete documentation.

## repoze.postoffice Changelog

### 0.25 (2014-09-30)

• Introduce the ‘find_queue’ function as an alternative to ‘open_queue’ for applications that will manage their own database connection.

### 0.24 (2013-10-10)

• Avoid throttling BCC’ed messages (those where X-Original-To is not present in To or CC), because they can’t be part of loops.

• Accept messages as non-duplicates which have the same Message-ID headers, but different X-Original-To headers. Rationale: on systems which add X-Original-To (postfix adds it by default), its presence indicates delivery to a separate user; we should allow it to be queued for attempted processing.

### 0.23 (2013-07-31)

• Enable configuration of the headers considred by the to_hostname filter.

• Update the headers considered by in the to_hostname filter to include X-Original-To by default. This header is set by Postfix to match the envelope recipient; including it allows matching messages for which the domain is BCC’ed or delivered from a mailing list.

### 0.22 (2013-07-26)

• Avoid erroring while logging messages with encoded header values E.g., some clients don’t escape non-ASCII in To: / From: / Subject: headers. See LP #1202770.

• Handle broken addresses in ToHostName filter more gracefully.

• Converted documentation to Sphinx.

• Moved repository to Github.

### 0.21 (2012-09-05)

• Make regexp filters case sensitive.

### 0.20 (2012-05-14)

• Only close databases we create ourselves in open_queue.

### 0.19 (2012-05-10)

• Allow calling application to provide an already open database to open_queue. (LP #985546)

### 0.18 (2012-04-19)

• Added graceful degeneration when provided with uknown character encoding in a MIME text part.

### 0.17 (2011-09-26)

• Added a header, ‘X-Postoffice-Date’, to queued messages. It records the time each message was received (as seconds since the epoch.) It is set to the modified time of the maildir message file.

### 0.16 (2011-06-30)

• Added better fault tolerance for insane date headers generated by spambots. (LP #697033)

### 0.15 (2011-06-15)

• Body checks are now multiline regexp checks. (LP #787573)

### 0.14 (2011-05-17)

• Fixed problem where the zodb_uri could be unicode, which eventually breaks the ZEO client for ZEO uris. zodb_uri is now converted to a UTF-8 string.

### 0.13 (2011-05-05)

• Fixed problem with header filters not working properly with non-ASCII characters in headers. (LP #777455)

• Fixed bug in regular expression body filter which improperly parsed the ‘Content-Type’ header in order to extract the character set of a Mime part.

### 0.12 (2011-04-25)

• Respect leading and trailing whitespace in rules files.

### 0.11 (2011-04-25)

• When a message is rejected by a filter, a message is logged showing which filter triggered the rejection.

### 0.10 (2011-04-20)

• Improved logging output now includes a timestamp.

• Worked around (probable) bug in stdlib email parser where a message part might have a charset set in the ‘Content-Type’ header, but message.get_charset() returns None.

### 0.9 (2011-04-15)

• Added greater fault tolerance for malformed email addresses. (Shakes fist at spammers.)

• Added four new filter types based on regular expression matching: header_regexp, header_regexp_file, body_regexp, body_regexp_file. See README.txt for information on how to use these new filters.

• Added a new option to the global configuration: reject_filters. This allows you to set up filters at a global level for rejecting certain messages. See README.txt for more information.

### 0.8 (2011-01-14)

• The ‘to_hostname’ filter now parses multiple email addresses and checks the ‘Cc’ header as well as the ‘To’ header. (LP #659243)

• If multiple incoming messages in a 24 hour period have the same Message-Id, they are presumed to be duplicates and all but the first are discarded. (LP #659243)

### 0.7 (2010-09-15)

• Fixed another case where non-RFC 2047 compliant headers could cause an exception to be raised. (LP #637484)

### 0.6 (2010-09-13)

• Added Queue.requeue_quarantined_messages() convenience method to API.

• Allow for multiple hosts in ‘to_hostname’ filter. (LP #614528)

• Added graceful degradation for non-RFC 2047 compliant headers, in order to avoid crashing when spambots send us malformed messages. (LP #637484)

### 0.5 (2010-08-03)

• Added ‘X-Postoffice: Bounced’ header to outgoing bounce and quarantine messages. The presence of this header is checked when importing messages and any messages which contain it are discarded. This is to prevent possible ricochets of bounce messages back into the system. (LP #612587)

• Incoming messages with a ‘From’ header which matches exactly its ‘To’ header are now discarded as probable spam. (LP #612588)

### 0.4 (2010-07-30)

• Fixed bug in processing body of bounce messages when non-ascii unicode characters are present.

### 0.3 (2010-07-20)

• Fixed divide by zero error when calculating instantaneous message frequency.

• Fixed bug in repoze.postoffice.queue.open_queue where a ZEO connection would be left open if there was a KeyError on the queue name.

### 0.2 (2010-06-29)

• Fixed bug in parsing headers with no values.

• Added ability to use arbitrary message headers as discriminator values in out of office loop detection.

• When messages exceed maximum message size, are throttled or are found to be an auto-response, they are no longer discarded. Instead these messages get an ‘X-Postoffice-Rejected’ header added where the value gives the reason for rejection. These messages are then consumable by clients in the normal way. It is up to the client to detect the ‘X-Postoffice-Rejected’ header and take appropriate action. This change was made to allow the client to determine what, if any, sort of bounce message should be generated if any of these conditions are true.

### 0.1 (2010-06-03)

• Initial Release.

## Project details

Uploaded source