Implement Sieve filtering error

I am trying to implement Sieve filtering on a new install, so I am running the latest version, Exim4 4.95. I followed [this] (GitHub - madeofstown/Sieve-email-filters-on-HestiaCP) on GitHub to install Sieve and this on adding the necessary lines in the exim4 config file. When I try to send an email to my server, it gets immediately rejected with a permanent error, if I change in the exim4 config "transport = " back to “local_delivery” the messages are delivered but the Sieve filter does not work. I am new to Exim4 and HestiaCP, so I am unsure how to troubleshoot this. The GitHub page is a few years old, so maybe something is incorrect? I did restart the exim4 and dovecot services after making changes.

If this is a new install, why not just let the hestia installer do the job? It has an option to install sieve.

If you didn’t add Sieve when installing Hestia, the best way to add it is to execute this script:

/usr/local/hestia/install/upgrade/manual/install_sieve.sh

The script installs the required packages, configures exim4, dovecot and roundcube.

As you have installed the packages and modified the conf manually, above script won’t work. If you are able to remove the installed sieve packages and recover the original conf for exim4, dovecot and roundcube before your modifications, you could execute the script and you will get sieve installed and configured in seconds.

If you can’t recover the conf, you should take a look to the script and compare what it does and what you did…

1 Like

I wish I had known. I am new to HestiaCP, Exim4, and Sieve and just installed HestiaCP with the default options. I am coming from Centos, Postfix, Procmail, and Webmin, so this configuration is all new to me. I wanted to use Exim4 filters but ran into problems with them not working, so it was recommended that I use Sieve instead. Thanks!

Okay, I wish that had popped up when I Googled how to install Sieve in HestiaCP. Thanks for the command. I will back-petal what I did and try that. Thanks!

Ok, I did just that. I removed everything, did a reboot, ran the command and it completed without error, then rebooted again. Now mail does come in, but the Sieve filter does not work. I see the /etc/exim4/exim4.conf.template file does have it going to “dovecot_virtual_delivery” but the filter is not taking effect and the “dovecot_virtual_delivery” looks different from the post I mentioned. I don’t see anything in the logs, is there a log level I can adjust to see what may be the issue? Thanks!

If you can’t see any relevant message about sieve in /var/log/dovecot.log check the log for the mail account:

/home/YourUser/mail/YourDomain/MailAccount/dovecot.sieve.log

What’s the filter you are trying to add?

cat /home/YourUser/mail/YourDomain/MailAccount/sieve/managesieve.sieve

Well, that log file does not exist.

The filter file that RoundCube created is “managed.sieve” and not “managedsieve.sieve” and I just have a basic filter of -

# rule:[gmail]
if header :contains "from" "gmail.com"
{
        fileinto "gmail";
}

to send any email from a gmail account to a folder called gmail just for testing.
Thanks!

That’s strange because by default managesieve plugin for roundcube uses managesieve as file name and .sieve as extension

$ grep -Eri '= "managesieve"|= "\.sieve"' /etc/roundcube/
/etc/roundcube/plugins/managesieve/config.inc.php:$config["managesieve_script_name"] = "managesieve";
/etc/roundcube/plugins/managesieve/config.inc.php:$config["managesieve_filename_extension"] = ".sieve";

Could you please check where the symbolic link dovecot.sieve points to?

ls -l /home/YourUser/mail/YourDomain/MailAccount/dovecot.sieve

Ok, I changed the file name. The grep did return the values you mentioned.

That did not exist, so I created a new user and found that those files/links had been created. I created the link in the existing user, and it worked! Thanks! Apparently, when you use the install script, it will not re-create those on existing users. It is all working now.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.