# Sieve filter not functioning

**URL:** <https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096>\
**Category:** Uncategorized\
**Created:** [July 29, 2022, 6:42pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096 "2022-07-29T18:42:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [July 29, 2022, 6:42pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/1 "2022-07-29T18:42:29Z")

</div>

Hello, I noticed that since a recent update my sieve filter is not working anymore. I tried to debug it with `mail_debug = yes` in `/etc/dovecot/conf.d/10-logging.conf` but I can’t seem to get to the root of the problem. Thanks in advance!

---

<div class="post-metadata">

**Author:** ![nada](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/nada/32/3028_2.png) [@nada](https://forum.hestiacp.com/u/nada)\
**Post date:** [July 30, 2022, 6:44am UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/2 "2022-07-30T06:44:19Z")

</div>

Hello @chris

your filter connect to Roundcube ? same issue happened with 1.6.2 solved by review basic setup of the filter and found port blocked by csf so unblocked it

I don’t know the reason but solved

note : after update to 1.6.5 issue didn’t appear  
I wish this help you

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [July 30, 2022, 7:07am UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/3 "2022-07-30T07:07:06Z")

</div>

> [@nada](#):
>
> your filter connect to Roundcube ? same issue happened with 1.6.2 solved by review basic setup of the filter and found port blocked by csf so unblocked it

Thanks a lot for your help @nada. I’m fairly new to this setup: you’re talking about port 4190, am I correct? Where / how exactly did you unblock it? (If I allow that port in the Firewall gui for the servers ip nothing changes.) These are my (untouched) dovecot config files:

/etc/dovecot/dovecot.conf

```auto
protocols = imap pop3
listen = *, ::
base_dir = /var/run/dovecot/
login_greeting = Mail Delivery Agent
!include conf.d/*.conf
!include_try conf.d/domains/*.conf

service stats {
  unix_listener stats-writer {
    group = mail
    mode = 0660
    user = dovecot
  }
}

service stats {
  unix_listener stats-writer {
    group = mail
    mode = 0660
    user = dovecot
  }
}

namespace {
    type = private
    separator = /
    inbox = yes
    list = yes

    mailbox Archive {
        auto = subscribe
        special_use = \Archive
    }

    mailbox Drafts {
        auto = subscribe
        special_use = \Drafts
    }

    mailbox Trash {
        auto = subscribe
        special_use = \Trash
    }

    mailbox "Deleted Messages" {
        auto = no
        special_use = \Trash
    }

    mailbox Spam {
        auto = subscribe
        special_use = \Junk
    }

    mailbox Junk {
        auto = no
        special_use = \Junk
    }

    mailbox Sent {
        auto = subscribe
        special_use = \Sent
    }

    mailbox "Sent Mail" {
        auto = no
        special_use = \Sent
    }
    
    mailbox "Sent Messages" {
        auto = no
        special_use = \Sent
    }
}

```

/etc/dovecot/conf.d/10-auth.conf

```auto
disable_plaintext_auth = no
auth_username_format = %u
auth_verbose = yes
auth_mechanisms = plain login
!include auth-passwdfile.conf.ext

```

/etc/dovecot/conf.d/10-logging.conf

```auto
log_path = /var/log/dovecot.log

```

/etc/dovecot/conf.d/20-imap.conf

```auto
##
## IMAP specific settings
##

protocol imap {
  # Maximum IMAP command line length. Some clients generate very long command
  # lines with huge mailboxes, so you may need to raise this if you get
  # "Too long argument" or "IMAP command line too large" errors often.
  #imap_max_line_length = 64k

  # Maximum number of IMAP connections allowed for a user from each IP address.
  # NOTE: The username is compared case-sensitively.
  #mail_max_userip_connections = 10

  # Space separated list of plugins to load (default is global mail_plugins).
  #mail_plugins = $mail_plugins
  mail_plugins = quota imap_quota imap_sieve

  # IMAP logout format string:
  # %i - total number of bytes read from client
  # %o - total number of bytes sent to client
  #imap_logout_format = bytes=%i/%o

  # Override the IMAP CAPABILITY response. If the value begins with '+',
  # add the given capabilities on top of the defaults (e.g. +XFOO XBAR).
  #imap_capability = 

  # How long to wait between "OK Still here" notifications when client is
  # IDLEing.
  #imap_idle_notify_interval = 2 mins

  # ID field names and values to send to clients. Using * as the value makes
  # Dovecot use the default value. The following fields have default values
  # currently: name, version, os, os-version, support-url, support-email.
  #imap_id_send = 

  # ID fields sent by client to log. * means everything.
  #imap_id_log =

  # Workarounds for various client bugs:
  # delay-newmail:
  # Send EXISTS/RECENT new mail notifications only when replying to NOOP
  # and CHECK commands. Some clients ignore them otherwise, for example OSX
  # Mail (<v2.1). Outlook Express breaks more badly though, without this it
  # may show user "Message no longer in server" errors. Note that OE6 still
  # breaks even with this workaround if synchronization is set to
  # "Headers Only".
  # tb-extra-mailbox-sep:
  # Thunderbird gets somehow confused with LAYOUT=fs (mbox and dbox) and
  # adds extra '/' suffixes to mailbox names. This option causes Dovecot to
  # ignore the extra '/' instead of treating it as invalid mailbox name.
  # tb-lsub-flags:
  # Show \Noselect flags for LSUB replies with LAYOUT=fs (e.g. mbox).
  # This makes Thunderbird realize they aren't selectable and show them
  # greyed out, instead of only later giving "not selectable" popup error.
  #
  # The list is space-separated.
  #imap_client_workarounds = 
}

```

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [July 30, 2022, 7:48am UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/4 "2022-07-30T07:48:58Z")

</div>

Roundcube should work fine without opening ports.

What is the exact error?

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [July 30, 2022, 8:04am UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/5 "2022-07-30T08:04:38Z")

</div>

Thanks @eris, I’m trying to find out what the cause of the issue is. I added `mail_debug=yes` to `root@host:/etc/dovecot/sieve# nano 20-managesieve.conf` within the `protocol sieve { }` block.  
Are the logs being written to `/var/log/syslog` by default?

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [July 30, 2022, 8:05am UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/6 "2022-07-30T08:05:53Z")

</div>

I think /var/log/dovecot?

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [July 30, 2022, 8:12am UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/7 "2022-07-30T08:12:29Z")

</div>

I thought so too: so I checked again `/var/log/dovecot.log` but nothing other than login/logout logs:

```auto
Jul 30 10:11:12 imap-login: Info: Login: user=<info@mydomain.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=7271, TLS, session=<rOtRTwHlUrt/AAAB>
Jul 30 10:11:12 imap(info@mydomain.com)<7271><rOtRTwHlUrt/AAAB>: Info: Disconnected: Logged out in=499 out=12896 deleted=0 expunged=0 trashed=0 hdr_count=24 hdr_bytes=5658 body_count=0 body_bytes=0

```

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [July 31, 2022, 12:31pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/8 "2022-07-31T12:31:04Z")

</div>

Unfortunately I can’t seem to activate the logging / debug sieve. I checked if managesieve-login and dovecot-managesieved are installed and checked these config files with the original installation files:

```auto
20-managesieve.conf  
90-sieve-extprograms.conf  
90-sieve.conf

```

Could you suggest me where else to look, or do I need to check the status of certain services?  
I’m on HestiaCP 1.6.5 with Ubuntu 22.04 (upgraded from 20.04).

P.s. during the last upgrade these services were restarted by default:

 ![Screenshot 2022-07-30 at 07.24.58](https://forum.hestiacp.com/uploads/default/original/2X/5/520af6b716b7f27ee70e25a366f533d4047943bc.png)

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [July 31, 2022, 1:07pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/9 "2022-07-31T13:07:05Z")

</div>

Restart should not affect them…

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [July 31, 2022, 2:08pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/10 "2022-07-31T14:08:12Z")

</div>

Exactly, I thought so too… Sieve also seems connected:

```auto
root@host:~# telnet host.myhestiacp.com 4190
Trying 127.0.0.1...
Connected to host.myhestiacp.com.
Escape character is '^]'.
"IMPLEMENTATION" "Dovecot Pigeonhole"
"SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapflags notify imapsieve vnd.dovecot.imapsieve"
"NOTIFY" "mailto"
"SASL" "PLAIN LOGIN"
"STARTTLS"
"VERSION" "1.0"
OK "Mail Delivery Agent"
BYE "Disconnected for inactivity."
Connection closed by foreign host.

```

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [July 31, 2022, 8:06pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/11 "2022-07-31T20:06:29Z")

</div>

If I enable `mail_debug = yes` in `/etc/dovecot/dovecot.conf` I get this as, hopefully helpful, log output:

````auto
Jul 31 22:01:38 imap-login: Info: Login: user=<info@mydomain.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=59942, TLS, session=<G0flWR/lNJF/AAAB>
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Loading modules from directory: /usr/lib/dovecot/modules
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Module loaded: /usr/lib/dovecot/modules/lib10_quota_plugin.so
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Module loaded: /usr/lib/dovecot/modules/lib11_imap_quota_plugin.so
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Module loaded: /usr/lib/dovecot/modules/lib95_imap_sieve_plugin.so
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Added userdb setting: plugin/quota_rule=*:storage=0M
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Effective uid=1002, gid=8, home=/home/chris
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Quota root: name=User quota backend=maildir args=
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Quota rule: root=User quota mailbox=* bytes=0 messages=0
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Quota grace: root=User quota bytes=0 (10%)
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Namespace : type=private, prefix=, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/home/chris/mail/mydomain.com/info
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: maildir++: root=/home/chris/mail/mydomain.com/info, index=, indexpvt=, control=, inbox=/home/chris/mail/mydomain.com/info, alt=
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: quota: quota_over_flag check: quota_over_script unset - skipping
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Mailbox INBOX: Mailbox opened because: STATUS
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Debug: Mailbox INBOX: Mailbox opened because: SELECT
Jul 31 22:01:38 imap(info@mydomain.com)<59942><G0flWR/lNJF/AAAB>: Info: Disconnected: Logged out in=209 out=1265 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0```
````

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [July 31, 2022, 9:20pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/12 "2022-07-31T21:20:40Z")

</div>

> [@chris](#):
>
> `Debug: quota: quota_over_flag check: quota_over_script unset - skippin`

I don’t see anything related sieve that is not working

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [August 1, 2022, 11:08am UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/13 "2022-08-01T11:08:32Z")

</div>

What is exactly not working?

Doesn’t it filter or doesn’t it send any forwarders / auto reply?

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [August 1, 2022, 11:45am UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/14 "2022-08-01T11:45:06Z")

</div>

It doesn’t want to filter or send any forwarders and replies when I configure them from Roundcube sieve. _(Forwarders and replies do work if I set them up within HestiaCP GUI)._

So neither the default x-spam-flag spam filter or any custom filters work. F.e. if I try to filter e-mails with subjet ‘singer’ into the folder ‘Singing’.

```auto
require ["fileinto"];
# rule:[SPAM]
if header :contains "x-spam-flag" "YES"
{
	fileinto "INBOX.Spam";
}
# rule:[Singing]
if allof (header :contains "subject" "singer")
{
	fileinto "Singing";
}

```

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [August 1, 2022, 12:47pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/15 "2022-08-01T12:47:55Z")

</div>

PS. Can it be a problem of incorrect file permissions / ownship?

```auto
root@host:/etc/dovecot/sieve# ls -l
total 24
-rw-r--r-- 1 root root 3050 Jul 30 12:10 20-managesieve.conf
-rw-r--r-- 1 root root 1825 Jan 17 2022 90-sieve-extprograms.conf
-rw-r--r-- 1 root root 10428 Jul 30 19:15 90-sieve.conf
-rw-r--r-- 1 root root 108 Jan 17 2022 default
root@host:/etc/dovecot/sieve# cd ..

root@host:/etc/dovecot# ls -l
total 44
drwxr-xr-x 3 root root 4096 Jul 29 21:20 conf.d
-rw-r----- 1 root dovecot 1507 Aug 26 2019 dovecot-dict-auth.conf.ext
-rw-r----- 1 root dovecot 522 Jul 14 00:21 dovecot-dict-sql.conf.ext
-rw-r----- 1 root dovecot 5824 Aug 26 2019 dovecot-sql.conf.ext
-rw-r--r-- 1 root root 1205 Jul 31 21:57 dovecot.conf
-rw-r--r-- 1 root root 4343 Jul 7 19:13 dovecot.conf.ucf-dist
-rw-r--r-- 1 root root 1200 Jul 30 08:18 dovecot.conf.vst.back
drwx------ 2 root root 4096 Jan 17 2022 private
drwxr-xr-x 2 root root 4096 Jul 30 19:16 sieve
root@host:/etc/dovecot# 

```

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [August 1, 2022, 1:09pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/16 "2022-08-01T13:09:16Z")

</div>

Should be fine

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [August 1, 2022, 1:20pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/17 "2022-08-01T13:20:34Z")

</div>

Thank you @eris. Do you have any other thoughts on this issue? I’m slowly pulling my hair at this point… 😅

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [August 1, 2022, 10:08pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/18 "2022-08-01T22:08:39Z")

</div>

Ok… I found the solution by editing: `/etc/exim4/exim4.conf.template`

1. Within the ‘Routers Configuration’ I changed the `localuser:`  
Old value: `transport = local_delivery`  
New value: `transport = dovecot_virtual_delivery`

2. Within the ‘Transports Configuration’ I added the following block right between the `local_spam_delivery` and the `address_pipe`:

```auto
dovecot_virtual_delivery:
  driver = pipe
  command = /usr/lib/dovecot/dovecot-lda -e -d $local_part@$domain -f $sender_address -a $original_local_part@$original_domain
  delivery_date_add
  envelope_to_add
  return_path_add
  log_output = true
  log_defer_output = true
  user = ${extract{2}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/passwd}}}}
  group = mail
  return_output

```

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [August 1, 2022, 10:12pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/19 "2022-08-01T22:12:45Z")

</div>

> [@chris](#):
>
> /etc/exim4/exim4.conf.template

You did upgrade from 20.04 to 22.04?

That might the issue

---

<div class="post-metadata">

**Author:** ![chris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chris/32/2327_2.png) [@chris](https://forum.hestiacp.com/u/chris)\
**Post date:** [August 1, 2022, 10:18pm UTC](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096/20 "2022-08-01T22:18:38Z")

</div>

> [@chris](#):
>
> I’m on HestiaCP 1.6.5 with Ubuntu 22.04 (upgraded from 20.04).

Yes, I did. But I did follow the documentation with these commands, so I never thought it could be an exim4 related issue:

```auto
rm -f /etc/exim4/exim4.conf.template
cp -f /usr/local/hestia/install/deb/exim/exim4.conf.4.94.template /etc/exim4/exim4.conf.template

```

Anyway, I’m glad it’s working again since it’s a vital function in my setup/ for my clients.

[Next page](https://forum.hestiacp.com/t/sieve-filter-not-functioning/7096.md?page=2)
