How to access original recipient in sieve scripts #3898
-
Hi,
Now I want to perform some actions on specific recipient-addresses, e.g. messages to fun@example.com should be moved to the folder Fun. I tried a sieve script like this:
but it didn't work. To debug, I tried the following script:
just to see where it ends up, and looking at the result it always ends up in user1@example.com.
Apparently, the Is there any way to make filtering with a catch-all by to-address possible? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
I think I came across a solution for that when I was writing up these notes, skip to near the end under the Those parts should have relevant links. You can shell into the DMS container running and use Virtual aliases like you'd use for your catch-all should be managed by Thus the advice should be related to When you know the settings you need,
#!/bin/bash
# Required for the Postfix to send with original recipient headers for Sieve to use:
# Change from default limit of 50 to 1,
# Postfix will send mail with multiple recipients to Dovecot one at a time
# instead of delegating to Dovecot to manage all at once:
postconf lmtp_destination_recipient_limit=1
# Modify the `lmtp` service to use the `lmtp` transport command with extra `flags=DO` arg:
# This will enable both `Delivered-To:` and `X-Original-To` headers for Sieve to have access:
postconf -F 'lmtp/unix/command=lmtp flags=DO' Those two commands you could use in the DMS container like I described earlier for testing, and if they work then persist that via There might be some other settings you'd need to look into, and the Sieve script maybe needs to look at those newly added headers instead, should be the I don't have time to investigate further than I did in my link, or apply the advice I'm providing here to verify unfortunately, but I'd appreciate hearing back what works for you so others can benefit, it'd also help towards a feature request issue for someone to contribute a feature/docs for 👍 |
Beta Was this translation helpful? Give feedback.
-
Alright, I am really not qualified enough to further debug this issue, so until someone has a better idea I will use a global sieve script that I found here: It takes the original to-address from the I also needed to add the |
Beta Was this translation helpful? Give feedback.
-
Another update: |
Beta Was this translation helpful? Give feedback.
I think I came across a solution for that when I was writing up these notes, skip to near the end under the
user-and-cc-local-alias.txt
section.Those parts should have relevant links.
You can shell into the DMS container running and use
nano /etc/postfix/master.cf
to edit that config, withpostfix reload
after saving to refresh those settings.Virtual aliases like you'd use for your catch-all should be managed by
virtual
, which we configure by default to deliver throughlmtp
to Dovecot:docker-mailserver/target/scripts/startup/setup.d/postfix.sh
Line 82 in a815bf5
Thus the advice should be related to
m…