Processdsn consumes RFC 3464 delivery status notification emails, writing a summary of the notification to a SQL database, as part of the Mail Service project. Notifications may indicate successful delivery, a delay in delivery, or delivery failure.
The tool is designed to be used as a mail delivery agent, called by a compatible mail transfer agent (such as Postfix) in response to a particular email address.
The database is designed to be exposed restfully by the mod_processdsn module for Apache httpd, but can queried directly if necessary.
Releases of processdsn are hosted by Sourceforge:
Releases are available as source tarballs for gzip and bzip2, as well as an SRPM for Redhat/Fedora/CentOS systems.
Processdsn depends on the DBD SQL database abstraction layer in APR-util.
In order to wire in processdsn to a Postfix setup, add the following entry to the /etc/postfix/master.cf file:
processdsn unix - n n - 16 pipe flags=F user=nobody argv=/usr/bin/processdsn --params=/var/spool/dsn.sqlite -- driver=sqlite3 -o /var/spool/dsn.txt
The "-o" option is optional, and specifies a text file to write the delivery status notification to for backup or debugging purposes.
The "--driver" option specifies the name of the APR DBD SQL database driver, and the "--params" option specifies the parameters for the given database. In the example above, a sqlite3 database is used at /var/spool/dsn.sqlite. Details of DBD can be found at http://people.apache.org/~niq/dbd.html, and http://httpd.apache.org/docs/2.2/mod/mod_dbd.html.
Then, wire in the above into the /etc/postfix/transport file, to map processdsn to a given email address:
At this point, any email addressed to "firstname.lastname@example.org" should be processed by processdsn.
For mail transfer agents other than Postfix, please consult the relevant documentation for your server.
Before processdsn will work correctly, a suitable database needs to be created and tables created within it.
A script called sqlite-create.txt is provided to create a sqlite database:
sqlite3 dsn.sqlite < sqlite-create.txt
To create databases for other platforms like postgres or mysql, consult the documentation for your database.
In order to remain protected from SQL injection attacks, ensure you use a SQL driver that supports prepared statements. This means that the TDS driver should be avoided.
Generating Delivery Status Notifications
The processdsn tool is designed to process any RFC 3464 compliant notifications from any mail server. To enable delivery status notifications when sending email from Postfix, add the "-N delay,failure,success" options to /usr/sbin/sendmail.
In order for processdsn to know the original email address, the Variable Envelope Return Path (VERP) feature needs to be enabled, using the Postfix "-XV" option.
Any mail transfer agent can be used, as long as it is possible to enable DSN and VERP.
Processdsn is designed to respond to delivery status notifications generated by the mod_sendmail httpd module, but this isn't mandatory. Any RFC 3464 compliant responses should do.