how to filter in doevecot/lmtp with sieve according to postfix orig_to value
Dear All,
I am managing an email infrastructure running with the below. Rocky Linux 8.7 (Green Obsidian) 4.18.0-425.3.1.el8.x86_64 postfix-3.5.8-4.el8.x86_64 dovecot-2.3.16-3.el8.x86_64 dovecot-pigeonhole-2.3.16-3.el8.x86_64 In reality there are more packages installed and configured. But I limited my enumeration above to what I think is relevant. I will be happy to provide more details if needed and/or requested.
Here is my problem, or at least on what I need help/guidance/assistance. I have a virtual alias that forward emails to support@example.com to my inbox tshimanga.minkoka@example.com. That works fine as I can see those emails in my INBOX. And I want those emails to be moved in INBOX/support with a local sieve rule. For that I have the below that works. # rule:[support] if allof (header :is "to" "support@example.com") { fileinto :create "INBOX/support"; }
The problem is that the above sieve rule seems not enough to catch email where support@example.com is not the "To" fields, as with cases of "Cc:" or "Bcc:".
In the log of postfix, I can see lines with "... postfix/lmtp ... orig_to=<support@example.com> ...". The problem I am facing is that "orig_to" is not part of the headers postfix/lmtp (in reality dovecot/lmtp process) can see in order to apply on it a sieve rule.
Any suggestions on how I can also sieve filter those emails ?
Regards,
Tshimanga
Hi Tshimanga,
On 17/11/2023 16:12, TSHIMANGA Minkoka wrote:
Dear All,
[...] The problem is that the above sieve rule seems not enough to catch email where support@example.com is not the "To" fields, as with cases of "Cc:" or "Bcc:".
It does not matter because your final recipient is tshimangaxxx@. Postfix wise, it's always sent *to* someone even if you use Bcc,Cc.
Can you see the sieve actions in the logs for incoming emails?
In the log of postfix, I can see lines with "... postfix/lmtp ... orig_to=<support@example.com> ...". The problem I am facing is that "orig_to" is not part of the headers postfix/lmtp (in reality dovecot/lmtp process) can see in order to apply on it a sieve rule.
It does not matter. As long as postfix set "to=<tshimanga.minkoka@example.com>" along orig_to=<supportxxx@xxx> ; it is not a problem. You said earlier you can see the emails in your mailbox.
Any suggestions on how I can also sieve filter those emails ?
Can you show your config? (doveconf -n)?
Have you enable sieve on dovecot? If sieve is enabled, you will see in your logs , lines with 'sieve'
-- Willy Manga @ongolaboy https://ongola.blogspot.com/
Dear Willy,
I thank you for your responses.
Find below in line my comments.
Regards,
Tshimanga
On 11/17/23 14:16, Willy Manga wrote:
Hi Tshimanga,
On 17/11/2023 16:12, TSHIMANGA Minkoka wrote:
Dear All,
[...] The problem is that the above sieve rule seems not enough to catch email where support@example.com is not the "To" fields, as with cases of "Cc:" or "Bcc:".
It does not matter because your final recipient is tshimangaxxx@. Postfix wise, it's always sent *to* someone even if you use Bcc,Cc. I need the value of orig_to to appear in a header so I can filter it with a sieve rule.
Can you see the sieve actions in the logs for incoming emails? Yes, I can see those actions in logs, but just when in the "To:" field. I am looking for a way to use the value of orig_to, as from what I can see its has the information I need.
In the log of postfix, I can see lines with "... postfix/lmtp ... orig_to=<support@example.com> ...". The problem I am facing is that "orig_to" is not part of the headers postfix/lmtp (in reality dovecot/lmtp process) can see in order to apply on it a sieve rule.
It does not matter. As long as postfix set "to=<tshimanga.minkoka@example.com>" along orig_to=<supportxxx@xxx> ; it is not a problem. You said earlier you can see the emails in your mailbox.
Any suggestions on how I can also sieve filter those emails ?
Can you show your config? (doveconf -n)? dovecot -n # 2.3.16 (7e2e900c1a): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.16 (09c29328) # OS: Linux 4.18.0-425.3.1.el8.x86_64 x86_64 Rocky Linux release 8.7 (Green Obsidian) # Hostname: mail.example.com auth_mechanisms = plain login first_valid_uid = 1000 imap_capability = +SPECIAL-USE lda_mailbox_autocreate = yes lmtp_save_to_detail_mailbox = yes mail_location = maildir:~/Maildir:LAYOUT=fs mail_plugins = quota 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 mbox_write_locks = fcntl namespace inbox { inbox = yes location = mailbox Drafts { auto = subscribe special_use = \Drafts } mailbox Junk { auto = create special_use = \Junk } mailbox Sent { auto = subscribe special_use = \Sent } mailbox Trash { auto = subscribe special_use = \Trash } prefix = separator = / type = private } passdb { args = /etc/dovecot/conf.d/dovecot-sql.conf.ext driver = sql } plugin { quota = maildir:User quota quota_exceeded_message = Storage quota for this account has been exceeded, please try again later. quota_grace = 10%% quota_max_mail_size = 10M quota_rule = *:bytes=1200M quota_rule2 = Trash:bytes=+10%% quota_rule3 = Spam:bytes=+10%% quota_status_nouser = DUNNO quota_status_overquota = 522 5.2.2 Mailbox is full and cannot receive any more emails quota_status_success = DUNNO quota_warning = bytes=100%% quota-warning 100 %u %d en quota_warning2 = bytes=90%% quota-warning 95 %u %d en quota_warning3 = bytes=90%% quota-warning 90 %u %d en quota_warning4 = bytes=90%% quota-warning 80 %u %d en quota_warning5 = bytes=90%% quota-warning 70 %u %d en quota_warning6 = -bytes=80%% quota-warning -80 %u %d en quota_warning7 = -bytes=75%% quota-warning -75 %u %d en quota_warning8 = -bytes=60%% quota-warning -60 %u %d en sieve = file:~/sieve;active=~/.dovecot.sieve sieve_before = /var/lib/dovecot/sieve.d/ } protocols = lmtp imap sieve service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0666 user = postfix } } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0600 user = postfix } } service managesieve-login { inet_listener sieve { port = 4190 } service_count = 1 } service quota-status { executable = /usr/libexec/dovecot/quota-status -p postfix unix_listener /var/spool/postfix/private/quota-status { group = postfix mode = 0660 user = postfix } } service quota-warning { executable = script /usr/local/bin/quota-warning.sh unix_listener quota-warning { group = virtualmail mode = 0660 user = dovecot } user = virtualmail } ssl = required ssl_cert = </etc/pki/dovecot/certs/dovecot.pem ssl_cipher_list = PROFILE=SYSTEM ssl_key = # hidden, use -P to show it userdb { driver = prefetch } userdb { args = /etc/dovecot/conf.d/dovecot-sql.conf.ext driver = sql } protocol lmtp { mail_plugins = quota sieve } protocol imap { mail_plugins = quota imap_quota imap_sieve }
Have you enable sieve on dovecot? If sieve is enabled, you will see in your logs , lines with 'sieve'
Yes, sieve is enable in dovecot and I can see its activity in the logs.
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
-- TSHIMANGA Minkoka +243 814443113 tshikose@tshimix.cd
participants (2)
-
TSHIMANGA Minkoka
-
Willy Manga