How to install sieve for dovecot on CentOS 6?

Categories: How to
Tags: ,
Comments: 2 Comments
Published on: February 8, 2014

Dovecot is a very powerful mail imap and po3 mail server. It also has a Sieve server integrated. We describe here in 3 steps how to install sieve for dovecot on a CentOS 6 linux distribution. This howto assume that dovecot is already running as well a mta server like postfix, exim or sendmail.

1 – Verify that dovecot is the lda

For sieve to work we need to use dovecot as a lda. This means that dovecot has to write the email to the email folder of the user for the final delivery. To verify that dovecot is the lda we can send an email to any user hosted by dovecot and grep the maillog file in real time like this.

tail -f /var/log/maillog | grep lda
Feb 8 16:33:07 localhost dovecot: lda(jeandebogue): msgid=<>: saved mail to INBOX
Feb 8 16:33:07 localhost postfix/local[2253]: 1B829BF666: to=<>, orig_to=<>, relay=local, delay=0.13, delays=0.04/0/0/0.09, dsn=2.0.0, status=sent (delivered to command: /usr/libexec/dovecot/deliver)

In the previous command we see that dovecot is the lda and is responsible to write the email to disk.

What to do if dovecot is not the lda?

If you don’t see a similar line it means that probably your mta is responsible for writing the email to the disk.


First of all verify that dovecot has the lda protocol enabled.
Here is the dovecot config responsible for the lda service in dovecot /etc/dovecot/conf.d/15-lda.conf.

protocol lda {
  # Space separated list of plugins to load (default is global mail_plugins).
  mail_plugins = sieve
  postmaster_address =


Second verify that your mta is configure to send the email to dovecot. You will need to check in the documentation and here is how to enable this with postfix.
Change the value mailbox_command in the postfix config file /etc/postfix/

mailbox_command = /usr/libexec/dovecot/deliver

2 – Install sieve

yum install dovecot-pigeonhole

That was easy.

3 – Configure sieve

Make sure that your plugin { } in /etc/dovecot/conf.d/90-plugin.conf look like this:

plugin {
  # setting_name = value
  # Sieve
    sieve_dir = ~/sieve
    sieve_global_dir = /home/sieve
    sieve_max_script_size = 1M

Change the protocols line in /etc/dovecot/dovecot.conf

protocols = imap pop3 sieve

Uncomment these lines in /etc/dovecot/conf.d/20-managesieve.conf

service managesieve-login {
  inet_listener sieve {
    port = 4190

Finally, add these lines into this file /home/jeandebogue/.dovecot.sieve of the user that needs a sieve rule.

require "fileinto";

if header :contains "subject" "test" {
        fileinto "test";

This sieve rule means if the email subject contains the word test, move the email into the test folder.

Don’t forget to create an imap folder call test!

Restart dovecot

service dovecot restart

Now if you send an email to the same user with a subject test you should see this in your maillog and also the email should be automatically move to the folder test.

Feb  8 17:56:12 wdy02 dovecot: lda(jeandebogue): sieve: msgid=<>: stored mail into mailbox 'test'
Feb  8 17:56:12 wdy02 postfix/local[1114]: B4654BF582: to=<>, orig_to=<>, relay=local, delay=0.15, delays=0.04/0.01/0/0.1, dsn=2.0.0, status=sent (delivered to command: /usr/libexec/dovecot/deliver)

It doesn’t work, I need help

If you follow these steps and you still can’t figure it out, you can enable more debug in dovecot to try to understand the problem. Change this value in /etc/dovecot/conf.d/10-logging.conf.

mail_debug = yes

It still doesn’t work, can you help me?

The values of dovecot and sieve should not be change on a live system without knowing what do they do. Enabling sieve on a live system is no trivial task. If you need help to enable sieve for dovecot on CentOS, please contact us and we will do it for you.

How to install sieve for dovecot on CentOS 6? was last modified: February 25th, 2014 by Jean Debogue
The following two tabs change content below.
Jean Debogue

Jean Debogue

IT consultant at Wedebugyou
I am a Canadian that lived a couple of years in Austria. My several years of experience in IT permits me to deliver quality solutions that scale for my clients. I am an expert in ipv6, security, web hosting, cloud and any kind of IT solutions. I am able to solve problems of great complexity. I like challenges and I always enjoy the process of achieving a successful outcome.
  1. Evalds says:

    Thanks a lot!
    Your “How-To” worked “out-of-the-box”, except, I had to append “sieve” to line “protocols” in file /etc/dovecot/dovecot.conf:
    protocols = pop3 imap sieve

    Thanks again!

Comments are closed.

Welcome , today is Monday, June 24, 2024