Re: Rewriting e-mail headers (recipients) in Postfix (not header_checks) depending on complex logic

2019-12-18 Thread Bill Cole

On 18 Dec 2019, at 14:22, voroni...@soft-masters.ru wrote:

I have a mail system on Postfix+dovecot+amavisd+spamassassin+clamav. 
Now
there is a task, an easy one, actually, but I still cannot find a 
solution.
I need to change headers in emails according to several rules. For 
example,


IF ( CONTAINS 'ALIAS_1' AND  CONTAINS 'SOMEONE FROM ALIAS_1')
OR (IF ='ALIAS_1' AND  CONTAINS 'SOMEONE FROM ALIAS_1')
THEN (DELETE 'THIS SOMEONE FROM ALIAS_1' FROM  AND DELIVER TO 
OTHERS)


or

IF =ANYBODY_FROM_ALIAS_1 AND =ALIAS_1
THEN DELETE 'ONE_EMAIL_ADDRESS_FROM_ALIAS_1' FROM  AND DELIVER TO
OTHERS.

or if such requirements could not be met at least some tool would be 
nice

that can add another TO_header or remove some for some conditions.


MIMEDefang (www.mimedefang.org) is a Milter which can do anything to a 
message that you can implement as a Perl snippet. In addition to 
manipulating messages and their routing, it also has hooks for 
SpamAssassin and a wide range of AV tools, which are its most common 
uses.



--
Bill Cole
b...@scconsult.com or billc...@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not For Hire (currently)


Re: Rewriting e-mail headers (recipients) in Postfix (not header_checks) depending on complex logic

2019-12-18 Thread Noel Jones

On 12/18/2019 1:22 PM, voroni...@soft-masters.ru wrote:
I have a mail system on Postfix+dovecot+amavisd+spamassassin+clamav. 
Now there is a task, an easy one, actually, but I still cannot find 
a solution. I need to change headers in emails according to several 
rules. For example,


|IF ( CONTAINS 'ALIAS_1' AND  CONTAINS 'SOMEONE FROM ALIAS_1')|

|OR (IF ='ALIAS_1' AND  CONTAINS 'SOMEONE FROM ALIAS_1')|

|THEN (DELETE 'THIS SOMEONE FROM ALIAS_1' FROM  AND DELIVER TO 
OTHERS) |


or

|IF =ANYBODY_FROM_ALIAS_1 AND =ALIAS_1|

|THEN DELETE 'ONE_EMAIL_ADDRESS_FROM_ALIAS_1' FROM  AND DELIVER 
TO OTHERS.|


or if such requirements could not be met at least some tool would be 
nice that can add another TO_header or remove some for some conditions.


For example in EXIM MTA it can be done with exim.filter, smth like:

|if FROM contains A then deliver to B,C,D|

and so on.

I have lurked through http://www.postfix.org/addon.html

but could not find anything useful there.

Header_checks internal feature of Postfix has limitations that make 
it useless in my case, IMHO.


Any help would be most appreciated!




Try milter-regex.






Rewriting e-mail headers (recipients) in Postfix (not header_checks) depending on complex logic

2019-12-18 Thread voronin_k
I have a mail system on Postfix+dovecot+amavisd+spamassassin+clamav. Now
there is a task, an easy one, actually, but I still cannot find a solution.
I need to change headers in emails according to several rules. For example,

IF ( CONTAINS 'ALIAS_1' AND  CONTAINS 'SOMEONE FROM ALIAS_1')
OR (IF ='ALIAS_1' AND  CONTAINS 'SOMEONE FROM ALIAS_1')
THEN (DELETE 'THIS SOMEONE FROM ALIAS_1' FROM  AND DELIVER TO OTHERS)  

or

IF =ANYBODY_FROM_ALIAS_1 AND =ALIAS_1
THEN DELETE 'ONE_EMAIL_ADDRESS_FROM_ALIAS_1' FROM  AND DELIVER TO
OTHERS.

or if such requirements could not be met at least some tool would be nice
that can add another TO_header or remove some for some conditions.

For example in EXIM MTA it can be done with exim.filter, smth like:

if FROM contains A then deliver to B,C,D

and so on.

I have lurked through  
http://www.postfix.org/addon.html

but could not find anything useful there.

Header_checks internal feature of Postfix has limitations that make it
useless in my case, IMHO.

Any help would be most appreciated!