[Dovecot] Dovecot + Sieve

Daniel L. Miller dmiller at amfes.com
Wed Sep 5 23:18:21 EEST 2007


pod wrote:
>>>>>> "DM" == Daniel L Miller <dmiller at amfes.com> writes:
>>>>>>             
>
>     DM> I've tried manually compiling the script.  I now have a "sieve"
>     DM> and a "sievec" in my mail folder, and the "sieve" variable in
>     DM> dovecot.conf (1.0.3) is set to /var/mail/%d/%u/sieve (The filename
>     DM> specified should be the script source, not the compiled version,
>     DM> correct?).
>
>     DM> I receive no errors from deliver using this method - but no
>     DM> evidence that the script is being followed, either.  I thought I'd
>     DM> start with something simple - when that didn't work I added a
>     DM> global fileinto directive - still not doing anything.  Do I need
>     DM> to set execute permissions or turn off world-readable permissions
>     DM> on the script or compiled version?
>
> Create the following config file or something similar:
>
> log_path = /dev/stderr
> info_log_path = /dev/stderr
>
> mail_debug = yes
> mail_location = maildir:%h/tmp/Maildir
>
> protocol lda {
>   postmaster_address = postmaster at example.org
>   mail_plugins = cmusieve
> }
>
> put it in, say, ~/tmp/dovecot.lda-debug.conf.  Directly invoke deliver as
> a regular user with the -c option pointing to this config file, e.g.
>
> user at shell$ date | /usr/libexec/dovecot/deliver -c ~/tmp/dovecot.lda-debug.conf
>
> Observe the output.
>   
Thank you for that extremely detailed debugging procedure.  Resulting 
output is below:

deliver(vmail): Sep 05 13:05:28 Info: Loading modules from directory: 
/usr/lib/dovecot/modules/lda
deliver(vmail): Sep 05 13:05:28 Info: Module loaded: 
/usr/lib/dovecot/modules/lda/lib90_cmusieve_plugin.so
deliver(vmail): Sep 05 13:05:28 Info: maildir: 
data=/var/mail/amfes.com/dmiller
deliver(vmail): Sep 05 13:05:28 Info: maildir: 
root=/var/mail/amfes.com/dmiller, index=/var/mail/amfes.com/dmiller, 
control=, inbox=
deliver(vmail): Sep 05 13:05:28 Info: msgid=: saved mail to INBOX

Based on this, the sieve script is not being executed at all.  My temp 
config is:

log_path = /dev/stderr
info_log_path = /dev/stderr
mail_debug = yes
mail_location = maildir:/var/mail/amfes.com/dmiller
protocol lda {
    postmaster_address = postmaster at amfes.com
    mail_plugins = cmusieve
    sieve = /var/mail/%d/%u/sieve
}

I did make a discovery - hardcoding the sieve path, without variables, 
e.g. sieve = /var/mail/amfes.com/dmiller/sieve - worked!

Is there a problem using the domain / user variables in the 
configuration file?
>     DM> require ["fileinto"];
>     DM> if header :contains ["From","To"] ["root at amfes.com","root at amfeslan.local"] {
>     DM>   fileinto "System-Messages";
>     DM> }
>     DM> fileinto "System-Messages";
>
> I think you ought to consider using an ADDRESS test rather than a HEADER
> test for this sort of match, thus
>
> if address :is :all ["from", "to"] ["root at amfes.com", "root at amfeslan.local"] {
>   # ... etc
> }
>
> which will do proper address matching (i.e. phrase or comment parts in
> headers won't match) against a reasonable set of sender and recipient
> headers (for example a CC header).
>   
I appreciate the assistance with the script as well - I obviously need 
to learn the sieve language.

-- 
Daniel


More information about the dovecot mailing list