Monday 2 August 2010

Replacing dmail with dovcot

When I replaced dmail with dovcot I found hit the issue that all of the users had entries in their .procmailrc files that referred to /opt/imap/dmail and used this to place their email in different mailboxes.
the command options of the dmail and dovcot also differ, for example, dmail:
:0 rw

* ^To:support@stormagic.com
/opt/imap/dmail username+Support

And the same with dovcot:
:0 rw

* ^To:support@stormagic.com
/usr/lib/dovecot/deliver -m Support

To get round this issue, rather than rewrite everyone's .procmailrc file I created the following dmail script which I saved as /opt/imap/dmail

root@email:~# cat /opt/imap/dmail

#!/bin/bash

DELIVER="/usr/lib/dovecot/deliver"
$DELIVER $(echo "$@"
sed -e 's#[^+]*##' -e 's#+\(.*\)#-m \1#')

1 comment: