-   Linux - Server (
-   -   sieve setup on dovecot 1.1.4 (

steven19782007 07-09-2009 04:08 PM

sieve setup on dovecot 1.1.4
Hi there

I am looking into setting up sieve mail filters on dovecot 1.1.4. I have been trying to find a good guide online that will talk me through it but they all seem a bit old. Does anyone have experience of doing this as I'm a bit scared of doing it on the live mail server where I work but I am being pressured into getting this done.

I have been looking at the dovecot.conf file and trying to work out what I need to do. So far I think I need to install the sieve plugin but I have seen in various places people saying that I will need to install 'deliver'. I was hoping someone could help me with this. I would be eternally grateful.



Berhanie 07-10-2009 12:41 PM

deliver should have been part of the dovecot install. It's essential, since deliver is the thing that executes the sieve scripts at delivery time. Configuration is trivial: you just need to add a single line in the protocol lda portion of the config file, as documented here under "Configuring".

You mention having to install the sieve plugin. The link above mentions this:

In Ubuntu, starting from version 7.10 Gutsy, the CMU Sieve plugin already comes with Dovecot regular install. In this case you do not have to download additional packages. Simply skip "Compiling" section and proceed to "Configuring". This is also true for Debian Etch.

steven19782007 07-11-2009 11:49 AM

sieve setup
That does seem straight forward enough. I will let you know once I have got it working, thanks very much for your help.

steven19782007 07-12-2009 01:40 PM

sieve setup
I have done the steps mentioned in the link you sent but I can not get my sieve scripts to work so far. I have added the line to the protocol lda section:

mail_plugins = cmusieve

The link mentions that the default location checked for sieve scripts is on a file called .dovecot.sieve in the users home directory so I have created a file at:


and put the following lines into it:

require "fileinto";

if header :contains "Subject" "test" {
fileinto "testing";

I also tried

require "fileinto";

if header :contains ["Subject"] ["test"] {
fileinto "testing";

I have created a folder called 'testing' using thunderbird but still any mails I send with subject 'test' go straight into the inbox. Should I be creating the folders somewhere special rather than in Thunderbird?

Berhanie 07-12-2009 03:32 PM

Are you sure that deliver is delivering the mail? If not, create a ~/.forward that is something like this:

| "/usr/local/libexec/dovecot/deliver"
Substitute your system's path to deliver.

steven19782007 07-12-2009 05:45 PM

sieve setup
I tried doing this and my mail gets bounced back. I assume you meant create a file called .forward in my home directory and put '| "/usr/local/libexec/dovecot/deliver"' in it? I did that and made it executable but no luck.

When I do a locate deliver, that is the path that gets returned, thats why I left out the 'libexec'. I have also tried manually compiling my sieve script (.dovecot.sieve) with sievec but that didn't work either. I appreciate your help with this. I am a bit of a noob when it comes to configuring mail servers.

Berhanie 07-12-2009 09:21 PM

I think you're making progress. What was the reason for the rejection?

So, the first task is to get deliver to deliver mail without any sieve scripts.
You can start here.

By the way, your script is good. It compiled automatically by deliver,
and I also did it manually with sievec. It also performed as intended.

steven19782007 07-13-2009 02:50 PM

sieve setup
The message I get when the mail is rejected is this:

Final-Recipient: rfc822;
Original-Recipient: rfc822;
Action: failed
Status: 5.3.5
Diagnostic-Code: x-unix; local configuration error

my dovecot.conf file contains the following in the protocol lda section:

protocol lda {
# Address to use when sending rejection mails.
#postmaster_address =

# Hostname to use in various parts of sent mails, eg. in Message-Id.
# Default is the system's real hostname.
#hostname =

# Support for dynamically loadable plugins. mail_plugins is a space separated
# list of plugins to load.
mail_plugins = cmusieve
mail_plugin_dir = /usr/lib/dovecot/modules/lda

# If user is over quota, return with temporary failure instead of
# bouncing the mail.
#quota_full_tempfail = no

# Format to use for logging mail deliveries. You can use variables:
# %$ - Delivery status message (e.g. "saved to INBOX")
# %m - Message-ID
# %s - Subject
# %f - From address
#deliver_log_format = msgid=%m: %$

# Binary to use for sending mails.
#sendmail_path = /usr/lib/sendmail

# Human readable error message for rejection mails. Use can use variables:
# %n = CRLF, %r = reason, %s = subject, %t = recipient
#rejection_reason = Your message to <%t> was automatically rejected:%n%r

# UNIX socket path to master authentication server to find users.
#auth_socket_path = /var/run/dovecot/auth-master

I tihnk I need to uncomment some more lines maybe but not sure which as I have no problems sending and receiving mails at the moment.

julianbaker 06-03-2010 03:16 PM

Did you ever manage to resolve this?

I'm trying to configure Dovecot to automatically forward mail to another account without the virtual user having to log-in first to Roundcube web mail.

These are virtual users with no log-in to the server only Roundcube's web interface

Exim handles regular domain email and would rather leave it as it is, since it handles email forwarding for a bunch of virtual sites.

The situation is that I have two domains who want to receive email at their domains, get a forwarded copy at their hotmail account, then log-in to Roundcube to reply.

A Sieve script running in Dovecot seems the way to go, but te finer points of configuration have failed me.

All times are GMT -5. The time now is 10:00 PM.