Creating a redmine email filter for postfix with virtual domains

This is adapted from the postfix virtual redme for autoreply transports. As such, I basically copy/paste that tutorial and edited it accordingly.

This assumes that you have set up redmine at its own subdomain as well as a postfix virtual domain, e.g. and wish to create a virtual redmine user for email processing, e.g.

In order to set up an redmine for virtual recipients as a final stop (no more filters applied), set up a rule in a virtual alias table:

    virtual_alias_maps = hash:/etc/postfix/virtual

This delivers mail sent to to the local address that handles the email. We service the address locally into the script parses emails for redmine.

DO NOT list in mydestination!

    transport_maps = hash:/etc/postfix/transport
/etc/postfix/transport:  redmine
redmine unix  -       n       n       -       10      pipe
    user=nobody argv=/path/to/redmine/extra/mail_handler/rdm-mailhandler.rb
    --url --key [redmine api key] --project kspecs
    --allow-override project,priority

This invokes/path/to/redmine/extra/mail_handler/rdm-mailhandler.rb and pipes any email sent to the redmine domain. Redmine handles rejection of invalid users, which is why we don’t bother with filtering valid addresses within postfix.

After this is done, do the standard postmap routine for your maps, then postfix reload.

Share on: TwitterFacebookGoogle+Email

Comments !