Monday, September 23, 2013

Redmine, procmail + rdm-mailhandler.rb howto

This is a quick solution on how to allow creation of new tickets in Redmine using Procmail and rdm-mailhandler.rb (provided by Redmine). Redmine's Wiki has a good page about processing incoming emails, but it lacks procmail's actual rules.

1. Configure Postfix to deliver local to procmail:

root@host# tail /etc/postfix/
virtual_alias_maps = hash:/etc/postfix/virtual
mailbox_command = /usr/bin/procmail

2. Configure aliases:

root@host# cat /etc/postfix/virtual
... redmine

3. Update aliases

root@host# newaliases

3. In redmine's home dir put the following procmail.rc:

redmine@host:~$ cat ~/.procmailrc

* ^TO_\s*[^@]+@redmine\.yourhost\.com
* ^TO_\s*\/[^@]+
| /var/www/ --url --key XXXXXXXXXXXXXXXXXXXXX --project $MATCH --tracker bug --allow-override tracker,priority --unknown-user create --no-permission-check --no-account-notice

Now to create new issue in redmine, you can send an email to, where `identifier` is redmine's project identifier, just do not forget to replace with your actual hostname.