Filtering mails with sieve filters
Hello good people,
I have dovecot- 2.3.7.2 (Ubuntu Ubuntu 20.04.1 LTS) running fine. However, I have a hitch with mail filtering.
Using SOGo as the webmail UI, I created a filter rule which resulted into the rule below:
require ["fileinto"]; if allof (address :contains "from" "odhiambo") { fileinto "INBOX/Odhiambo"; }
However, the test mail I sent did not end up the folder expected.
lda.log contains this info:
Oct 30 07:39:07 lda(wash@mydomain)<2415266>
And the .dovecot.sieve.log contains:
sieve: info: started log at Oct 30 07:39:07.
error: msgid=
What might be the problem here??
dovecot -n output is below:
# 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.7.2 () # OS: Linux 5.4.0-29-generic x86_64 Ubuntu 20.04.1 LTS ext4 # Hostname: jp.mydomain auth_mechanisms = plain login auth_socket_path = /var/run/dovecot/auth-userdb debug_log_path = /var/log/dovecot/debug.log default_login_user = dovecot default_vsz_limit = 2 G disable_plaintext_auth = no first_valid_uid = 110 hostname = gw.mydomain info_log_path = /var/log/dovecot/info.log log_path = /var/log/dovecot/error.log mail_gid = Debian-exim mail_location = maildir:/var/spool/virtual/%d/%n/Maildir:INDEX=/var/spool/virtual/indexes/%d/%1n/%n mail_plugins = fts mail_privileged_group = mail mail_server_admin = postmaster@mydomain mail_uid = Debian-exim managesieve_notify_capability = mailto managesieve_sieve_capability = 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 imapsieve vnd.dovecot.imapsieve namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = } passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { fts_autoindex = yes fts_autoindex_exclude = \Junk fts_autoindex_exclude2 = \Trash fts_autoindex_exclude3 = \Drafts fts_autoindex_exclude4 = \Spam fts_enforced = yes imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve imapsieve_mailbox1_causes = COPY imapsieve_mailbox1_name = Spam imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_from = Spam imapsieve_mailbox2_name = * plugin = fts managesieve sieve sieve = file:~/sieve;active=~/.dovecot.sieve sieve_execute_bin_dir = /usr/lib/dovecot/sieve-execute sieve_filter_bin_dir = /usr/lib/dovecot/sieve-filter sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment sieve_pipe_bin_dir = /usr/lib/dovecot/sieve sieve_plugins = sieve_imapsieve sieve_extprograms } postmaster_address = postmaster@mydomain protocols = imap lmtp sieve service auth { unix_listener auth-client { mode = 0600 user = Debian-exim } unix_listener auth-userdb { group = Debian-exim user = Debian-exim } } service stats { unix_listener stats-reader { user = Debian-exim } unix_listener stats-writer { user = Debian-exim } } service submission-login { inet_listener submission { port = 2587 } } ssl_cert =
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
Answering to myself,
The issue was as a result of a config parameter for SOGo:
Changed NGImap4ConnectionStringSeparator = "/";
to
NGImap4ConnectionStringSeparator = ".";
and the problem is solved.
On Fri, 30 Oct 2020 at 11:43, Odhiambo Washington odhiambo@gmail.com wrote:
Hello good people,
I have dovecot- 2.3.7.2 (Ubuntu Ubuntu 20.04.1 LTS) running fine. However, I have a hitch with mail filtering.
Using SOGo as the webmail UI, I created a filter rule which resulted into the rule below:
require ["fileinto"]; if allof (address :contains "from" "odhiambo") { fileinto "INBOX/Odhiambo"; }
However, the test mail I sent did not end up the folder expected.
lda.log contains this info: Oct 30 07:39:07 lda(wash@mydomain)<2415266>
: Info: sieve: msgid= : stored mail into mailbox 'INBOX' Oct 30 07:39:07 lda(wash@mydomain)<2415266> : Info: sieve: Execution of script /var/spool/virtual/mydomain/wash/.dovecot.sieve failed, but implicit keep was successful (user logfile /var/spool/virtual/mydomain/wash/.dovecot.sieve.log may reveal additional details) And the .dovecot.sieve.log contains: sieve: info: started log at Oct 30 07:39:07. error: msgid=
: failed to store into mailbox 'INBOX/Odhiambo': *Invalid mailbox name: Name must not have '/' characters.* What might be the problem here??
dovecot -n output is below:
# 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.7.2 () # OS: Linux 5.4.0-29-generic x86_64 Ubuntu 20.04.1 LTS ext4 # Hostname: jp.mydomain auth_mechanisms = plain login auth_socket_path = /var/run/dovecot/auth-userdb debug_log_path = /var/log/dovecot/debug.log default_login_user = dovecot default_vsz_limit = 2 G disable_plaintext_auth = no first_valid_uid = 110 hostname = gw.mydomain info_log_path = /var/log/dovecot/info.log log_path = /var/log/dovecot/error.log mail_gid = Debian-exim mail_location = maildir:/var/spool/virtual/%d/%n/Maildir:INDEX=/var/spool/virtual/indexes/%d/%1n/%n mail_plugins = fts mail_privileged_group = mail mail_server_admin = postmaster@mydomain mail_uid = Debian-exim managesieve_notify_capability = mailto managesieve_sieve_capability = 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 imapsieve vnd.dovecot.imapsieve namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = } passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { fts_autoindex = yes fts_autoindex_exclude = \Junk fts_autoindex_exclude2 = \Trash fts_autoindex_exclude3 = \Drafts fts_autoindex_exclude4 = \Spam fts_enforced = yes imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve imapsieve_mailbox1_causes = COPY imapsieve_mailbox1_name = Spam imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_from = Spam imapsieve_mailbox2_name = * plugin = fts managesieve sieve sieve = file:~/sieve;active=~/.dovecot.sieve sieve_execute_bin_dir = /usr/lib/dovecot/sieve-execute sieve_filter_bin_dir = /usr/lib/dovecot/sieve-filter sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment sieve_pipe_bin_dir = /usr/lib/dovecot/sieve sieve_plugins = sieve_imapsieve sieve_extprograms } postmaster_address = postmaster@mydomain protocols = imap lmtp sieve service auth { unix_listener auth-client { mode = 0600 user = Debian-exim } unix_listener auth-userdb { group = Debian-exim user = Debian-exim } } service stats { unix_listener stats-reader { user = Debian-exim } unix_listener stats-writer { user = Debian-exim } } service submission-login { inet_listener submission { port = 2587 } } ssl_cert =
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
You might consider adding "stop;" after the fileinto, otherwise a second match might process the message again, moving it elsewhere, etc.
Tom.
On 10/30/2020 5:47 AM, Odhiambo Washington wrote:
Answering to myself,
The issue was as a result of a config parameter for SOGo:
Changed NGImap4ConnectionStringSeparator = "/";
to
NGImap4ConnectionStringSeparator = ".";
and the problem is solved.
On Fri, 30 Oct 2020 at 11:43, Odhiambo Washington
mailto:odhiambo@gmail.com> wrote: Hello good people, I have dovecot- 2.3.7.2 (Ubuntu Ubuntu 20.04.1 LTS) running fine. However, I have a hitch with mail filtering. Using SOGo as the webmail UI, I created a filter rule which resulted into the rule below: require ["fileinto"]; if allof (address :contains "from" "odhiambo") { fileinto "INBOX/Odhiambo"; } However, the test mail I sent did not end up the folder expected. lda.log contains this info: Oct 30 07:39:07 lda(wash@mydomain)<2415266><tSKSHhvDm1+i2iQA9H6eMA>: Info: sieve: msgid=<CAAdA2WNqXpG1qmOmKp_pJPS6iQrEPeS6=vM_=o8UnvR152x54Q@mail.gmail.com <mailto:o8UnvR152x54Q@mail.gmail.com>>: stored mail into mailbox 'INBOX' Oct 30 07:39:07 lda(wash@mydomain)<2415266><tSKSHhvDm1+i2iQA9H6eMA>: Info: sieve: Execution of script /var/spool/virtual/mydomain/wash/.dovecot.sieve failed, but implicit keep was successful (user logfile /var/spool/virtual/mydomain/wash/.dovecot.sieve.log may reveal additional details) And the .dovecot.sieve.log contains: sieve: info: started log at Oct 30 07:39:07. error: msgid=<CAAdA2WNqXpG1qmOmKp_pJPS6iQrEPeS6=vM_=o8UnvR152x54Q@mail.gmail.com <mailto:o8UnvR152x54Q@mail.gmail.com>>: failed to store into mailbox 'INBOX/Odhiambo': *Invalid mailbox name: Name must not have '/' characters.* * * What might be the problem here?? dovecot -n output is below: # 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.7.2 () # OS: Linux 5.4.0-29-generic x86_64 Ubuntu 20.04.1 LTS ext4 # Hostname: jp.mydomain auth_mechanisms = plain login auth_socket_path = /var/run/dovecot/auth-userdb debug_log_path = /var/log/dovecot/debug.log default_login_user = dovecot default_vsz_limit = 2 G disable_plaintext_auth = no first_valid_uid = 110 hostname = gw.mydomain info_log_path = /var/log/dovecot/info.log log_path = /var/log/dovecot/error.log mail_gid = Debian-exim mail_location = maildir:/var/spool/virtual/%d/%n/Maildir:INDEX=/var/spool/virtual/indexes/%d/%1n/%n mail_plugins = fts mail_privileged_group = mail mail_server_admin = postmaster@mydomain mail_uid = Debian-exim managesieve_notify_capability = mailto managesieve_sieve_capability = 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 imapsieve vnd.dovecot.imapsieve namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = } passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { fts_autoindex = yes fts_autoindex_exclude = \Junk fts_autoindex_exclude2 = \Trash fts_autoindex_exclude3 = \Drafts fts_autoindex_exclude4 = \Spam fts_enforced = yes imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve imapsieve_mailbox1_causes = COPY imapsieve_mailbox1_name = Spam imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_from = Spam imapsieve_mailbox2_name = * plugin = fts managesieve sieve sieve = file:~/sieve;active=~/.dovecot.sieve sieve_execute_bin_dir = /usr/lib/dovecot/sieve-execute sieve_filter_bin_dir = /usr/lib/dovecot/sieve-filter sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment sieve_pipe_bin_dir = /usr/lib/dovecot/sieve sieve_plugins = sieve_imapsieve sieve_extprograms } postmaster_address = postmaster@mydomain protocols = imap lmtp sieve service auth { unix_listener auth-client { mode = 0600 user = Debian-exim } unix_listener auth-userdb { group = Debian-exim user = Debian-exim } } service stats { unix_listener stats-reader { user = Debian-exim } unix_listener stats-writer { user = Debian-exim } } service submission-login { inet_listener submission { port = 2587 } } ssl_cert = </etc/letsencrypt/live/mydomain/fullchain.pem ssl_client_ca_dir = /etc/ssl/certs ssl_dh = # hidden, use -P to show it ssl_key = # hidden, use -P to show it userdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } protocol lmtp { info_log_path = /var/log/dovecot/lmtp.log log_path = /var/log/dovecot/lmtp-errors.log mail_plugins = fts sieve postmaster_address = postmaster@mydomain } protocol lda { info_log_path = /var/log/dovecot/lda.log log_path = /var/log/dovecot/lda-errors.log mail_plugins = fts sieve } -- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
I doubt there is a way to do that when using the SOGo web UI.
On Fri, 30 Oct 2020 at 15:57, Tom Talpey tom@talpey.com wrote:
You might consider adding "stop;" after the fileinto, otherwise a second match might process the message again, moving it elsewhere, etc.
Tom.
On 10/30/2020 5:47 AM, Odhiambo Washington wrote:
Answering to myself,
The issue was as a result of a config parameter for SOGo:
Changed NGImap4ConnectionStringSeparator = "/";
to
NGImap4ConnectionStringSeparator = ".";
and the problem is solved.
On Fri, 30 Oct 2020 at 11:43, Odhiambo Washington
mailto:odhiambo@gmail.com> wrote: Hello good people, I have dovecot- 2.3.7.2 (Ubuntu Ubuntu 20.04.1 LTS) running fine. However, I have a hitch with mail filtering. Using SOGo as the webmail UI, I created a filter rule which resulted into the rule below: require ["fileinto"]; if allof (address :contains "from" "odhiambo") { fileinto "INBOX/Odhiambo"; } However, the test mail I sent did not end up the folder expected. lda.log contains this info: Oct 30 07:39:07 lda(wash@mydomain)<2415266><tSKSHhvDm1+i2iQA9H6eMA>: Info: sieve: msgid=<CAAdA2WNqXpG1qmOmKp_pJPS6iQrEPeS6=vM_=
o8UnvR152x54Q@mail.gmail.com
<mailto:o8UnvR152x54Q@mail.gmail.com>>: stored mail into mailbox
'INBOX'
Oct 30 07:39:07 lda(wash@mydomain)<2415266><tSKSHhvDm1+i2iQA9H6eMA>: Info: sieve: Execution of script /var/spool/virtual/mydomain/wash/.dovecot.sieve failed, but implicit keep was successful (user logfile /var/spool/virtual/mydomain/wash/.dovecot.sieve.log may reveal additional details) And the .dovecot.sieve.log contains: sieve: info: started log at Oct 30 07:39:07. error: msgid=<CAAdA2WNqXpG1qmOmKp_pJPS6iQrEPeS6=vM_=
o8UnvR152x54Q@mail.gmail.com
<mailto:o8UnvR152x54Q@mail.gmail.com>>: failed to store into mailbox 'INBOX/Odhiambo': *Invalid mailbox name: Name must not have '/' characters.* * * What might be the problem here?? dovecot -n output is below: # 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.7.2 () # OS: Linux 5.4.0-29-generic x86_64 Ubuntu 20.04.1 LTS ext4 # Hostname: jp.mydomain auth_mechanisms = plain login auth_socket_path = /var/run/dovecot/auth-userdb debug_log_path = /var/log/dovecot/debug.log default_login_user = dovecot default_vsz_limit = 2 G disable_plaintext_auth = no first_valid_uid = 110 hostname = gw.mydomain info_log_path = /var/log/dovecot/info.log log_path = /var/log/dovecot/error.log mail_gid = Debian-exim mail_location =
maildir:/var/spool/virtual/%d/%n/Maildir:INDEX=/var/spool/virtual/indexes/%d/%1n/%n
mail_plugins = fts mail_privileged_group = mail mail_server_admin = postmaster@mydomain mail_uid = Debian-exim managesieve_notify_capability = mailto managesieve_sieve_capability = 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 imapsieve vnd.dovecot.imapsieve
namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = } passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { fts_autoindex = yes fts_autoindex_exclude = \Junk fts_autoindex_exclude2 = \Trash fts_autoindex_exclude3 = \Drafts fts_autoindex_exclude4 = \Spam fts_enforced = yes imapsieve_mailbox1_before =
file:/usr/lib/dovecot/sieve/report-spam.sieve
imapsieve_mailbox1_causes = COPY imapsieve_mailbox1_name = Spam imapsieve_mailbox2_before =
file:/usr/lib/dovecot/sieve/report-ham.sieve
imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_from = Spam imapsieve_mailbox2_name = * plugin = fts managesieve sieve sieve = file:~/sieve;active=~/.dovecot.sieve sieve_execute_bin_dir = /usr/lib/dovecot/sieve-execute sieve_filter_bin_dir = /usr/lib/dovecot/sieve-filter sieve_global_extensions = +vnd.dovecot.pipe
+vnd.dovecot.environment
sieve_pipe_bin_dir = /usr/lib/dovecot/sieve sieve_plugins = sieve_imapsieve sieve_extprograms } postmaster_address = postmaster@mydomain protocols = imap lmtp sieve service auth { unix_listener auth-client { mode = 0600 user = Debian-exim } unix_listener auth-userdb { group = Debian-exim user = Debian-exim } } service stats { unix_listener stats-reader { user = Debian-exim } unix_listener stats-writer { user = Debian-exim } } service submission-login { inet_listener submission { port = 2587 } } ssl_cert = </etc/letsencrypt/live/mydomain/fullchain.pem ssl_client_ca_dir = /etc/ssl/certs ssl_dh = # hidden, use -P to show it ssl_key = # hidden, use -P to show it userdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } protocol lmtp { info_log_path = /var/log/dovecot/lmtp.log log_path = /var/log/dovecot/lmtp-errors.log mail_plugins = fts sieve postmaster_address = postmaster@mydomain } protocol lda { info_log_path = /var/log/dovecot/lda.log log_path = /var/log/dovecot/lda-errors.log mail_plugins = fts sieve } -- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
participants (2)
-
Odhiambo Washington
-
Tom Talpey