[Dovecot] use sieve plugin with variable and folders
Stephan Bosch
stephan at rename-it.nl
Tue Aug 28 18:25:54 EEST 2012
Op 8/28/2012 4:38 PM, Alano Conraz schreef:
> Hello ,
>
> I'm trying to use the pigeonhole plugin but I'm experiencing configuration
> problem... Hope you could help me!
>
> Firstly :
> my sieve filter test is the next one :
> ///////////////////
> require ["fileinto" , "variables" , "mailbox"];
>
> if address :matches "Delivered-To" "*@*.*" {
> fileinto :create ".INBOX.iop" ; stop ;
> }
> ////////////////////
>
> I get in the log the following : "error: msgid=<****>: failed to store into
> mailbox '.INBOX.iop': Invalid mailbox name"
> And the email is stored in the INBOX (implicit keep was successful)
> I checked that "lda_mailbox_autocreate" and "lda_mailbox_autosubscribre"
> are set to "yes".
Mailbox name should probably not start with a '.'. I'm assuming it is a
maildir storage. The physical mailbox directories in that maildir have a
'.' prefix, but the actual mailbox name does not: it should be 'INBOX.iop'.
> Then , when this problem be solved, I would like to know if it is possible
> with the sieve plugin to implement the following algorithm :
> - extract the address from the header field "Delivered-To" and set the
> variable $delivto to this previous value.
> - extract the address from the header field "To" and set the variable
> $to to this previous value.
> - compare $delivto and $to : if they are diffrent, then redirect the
> email in the subfolder .INBOX.iop.
>
>
> Thank you for any help!
Something like this:
require ["fileinto", "variables", "mailbox"];
if address :matches "delivered-to" "*" { set "delivto" "${1}"; }
if address :matches "to" "*" { set "to" "${1}"; }
if not string "${delivto}" "${to}" {
fileinto :create "INBOX.iop";
stop;
}
For reference you can read RFC5229 (http://tools.ietf.org/html/rfc5229).
Regards,
Stephan.
More information about the dovecot
mailing list