Re: Inconsistent filtering with debugging

2023-03-10 Thread Stephan Bosch



Op 24-2-2023 om 14:03 schreef Christian Wolf:

Hello,

I have the problem, that I have a Postfix/Dovecot combination running 
with Sieve activated. The sieve script is running in general as some 
messages get filtered and moved to the appropriate folders.


Now, I see that for the envelope filter, the behavior differs 
depending if I am debugging the rules or if the mails are received in 
a regular way.


I have something like this:

require "envelope";

# ...

if envelope :is "to" "f...@subdaomin.example.com" {
fileinto "INBOX.bar";
stop;
}

# ...

The thing is if I call sieve-filter on the INBOX, I get the 
information that the mail is to be moved to the appropriate folder. 
However during delivery the mail is not moved there. Other rules in 
the script are working so it is installed in general.


Of course, I could send mails to the mail address for testing but I 
have no clue on where to look for issues, especially as the "main 
debugging tool" for the rules (sieve-filter) is strangely behaving 
differently.


The reason, I wanted to use the envelope was because the mails are 
delivered to f...@subdomain.example.com. From there, some virtual 
aliases are forwarded to a cental account b...@example.net using 
postfix virtual aliases. Thus, the Delivered-To header is always 
showing the value b...@example.net which is not suited for filtering.


I could filter the Received headers but hoped for a more "high level" 
solution.


You can fill in the envelope addresses using command line options (see 
man pages). If you don't, it will fill in some defaults based on the 
provided message.


You can debug the actual delivery by using the sieve_trace setting.

Regards,

Stephan.




Re: Inconsistent filtering with debugging

2023-02-24 Thread Christian Wolf

Hello,

Am 2023-02-24 um 16:16 schrieb dove...@ptld.com:

You didn't say either way, so this is a guess.


Sorry, what did you mean?

Sieve is only ran by Dovecot. If Postfix is configured to deliver mail 
directly (the default), where Postfix writes the email to drive, then 
Dovecot never knows delivery happened and doesn't have a chance to run 
Sieve. Postfix must send the email to Dovecot and let Dovecot save the 
email to drive in which then Sieve would run. One option to do this is 
having Postfix deliver to dovecot LMTP.


https://doc.dovecot.org/configuration_manual/howto/postfix_dovecot_lmtp/


I have in Postfix configured:

virtual_transport = lmtp:unix:private/dovecot-lmtp

The file private/dovecot-lmtp is the socket of dovecot.

So, I am running through LMTP.

Christian


Re: Inconsistent filtering with debugging

2023-02-24 Thread dovecot

I have the problem, that I have a Postfix/Dovecot combination running with 
Sieve activated.
The thing is if I call sieve-filter on the INBOX, I get the information that 
the mail is to be moved to the appropriate folder.
However during delivery the mail is not moved there. Other rules in the script 
are working so it is installed in general.



You didn't say either way, so this is a guess.

Sieve is only ran by Dovecot. If Postfix is configured to deliver mail directly 
(the default), where Postfix writes the email to drive, then Dovecot never 
knows delivery happened and doesn't have a chance to run Sieve. Postfix must 
send the email to Dovecot and let Dovecot save the email to drive in which then 
Sieve would run. One option to do this is having Postfix deliver to dovecot 
LMTP.

https://doc.dovecot.org/configuration_manual/howto/postfix_dovecot_lmtp/


Inconsistent filtering with debugging

2023-02-24 Thread Christian Wolf

Hello,

I have the problem, that I have a Postfix/Dovecot combination running 
with Sieve activated. The sieve script is running in general as some 
messages get filtered and moved to the appropriate folders.


Now, I see that for the envelope filter, the behavior differs depending 
if I am debugging the rules or if the mails are received in a regular way.


I have something like this:

require "envelope";

# ...

if envelope :is "to" "f...@subdaomin.example.com" {
fileinto "INBOX.bar";
stop;
}

# ...

The thing is if I call sieve-filter on the INBOX, I get the information 
that the mail is to be moved to the appropriate folder. However during 
delivery the mail is not moved there. Other rules in the script are 
working so it is installed in general.


Of course, I could send mails to the mail address for testing but I have 
no clue on where to look for issues, especially as the "main debugging 
tool" for the rules (sieve-filter) is strangely behaving differently.


The reason, I wanted to use the envelope was because the mails are 
delivered to f...@subdomain.example.com. From there, some virtual aliases 
are forwarded to a cental account b...@example.net using postfix virtual 
aliases. Thus, the Delivered-To header is always showing the value 
b...@example.net which is not suited for filtering.


I could filter the Received headers but hoped for a more "high level" 
solution.


Can you give me any advice?
Christian