NerdVana

We're not anti-social; we're just not user friendly

smtprouted: a SMTP rewrite/dedupe proxy

Written by Eric Schwimmer

At work we send a lot of mail. Like A LOT of mail. So we need to have processes in place to test large mail loads and their impact on various internal work-processes. Of course, when we send these large test batch emails, we can't have them forwarded to the users that they are addressed to (this would defeat the whole 'test' thing). So instead we have all of the boxes sending test email relay their messages through a catchall box configured with postfix, dovecot and Roundcube, so devs can view the results of their test email runs.

However, problems arose when devs started adding Cc: and Bcc: lines to their test mails. Our catchall box accepts any message forwarded to any address, and then drops it in a test account on the box. When there are multiple Cc: and Bcc: lines attached to a message, this would cause the message to be duplicated a large number of times. And since this catchall box was getting 200k unique messages a day anyway, this would cause the inbox to fill up very quickly.

So I wrote a little Python SMTP daemon that would accept incoming email, and de-duplicate it, if necessary. I also gave it the ability to forward message to arbitrary endpoints, based on regular expression matching of individual email address, and the ability the rewrite destination addresses on the fly.

You can find it on github, here


comments powered by Disqus