Hi,

in http://www.postfix.org/header_checks.5.html you can find following:

>        REDIRECT user@domain
>               Write a message redirection  request  to  the  queue  file,  and
>               inspect  the  next  input  line. After the message is queued, it
>               will be sent to the specified address instead  of  the  intended
>               recipient(s).
> 
This could be the part you won't like most:
>               Note:  this  action overrides the FILTER action, and affects all
>               recipients of the message. If multiple  REDIRECT  actions  fire,
>               only the last one is executed.
> 
>               This feature is available in Postfix 2.1 and later.
> 
>               This feature is not supported with smtp header/body checks.
---

Did you try to redirect mail by means of alias or virtual table? Would't
that do, what you need?


Willi



Am 24.06.2015 um 09:42 schrieb Matteo Manzinello:
>  
> 
> I have a problem with "header_checks" rules. The emails that match with
> one rules skip the amavis check. 
> 
> Below the log translations with normal email: 
> 
> Jun 23 15:58:13 server postfix/smtpd[6002]: connect from
> host35-4.82-193.overlinx.net[82.193.35.4]
> Jun 23 15:58:13 server postfix/smtpd[6002]: Anonymous TLS connection
> established from host35-4.82-193.overlinx.net[82.193.35.4]: TLSv1.2 with
> cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
> Jun 23 15:58:13 server postfix/smtpd[6002]: DE52181082:
> client=host35-4.82-193.overlinx.net[82.193.35.4]
> Jun 23 15:58:13 server postfix/cleanup[6009]: DE52181082:
> message-id=<ca+za1hmsnhtfu-+vimq1h6r-gder5cvl0xonh+m4fchtgf6...@mail.gmail.com>
> Jun 23 15:58:13 server opendkim[1364]: DE52181082:
> host35-4.82-193.overlinx.net [82.193.35.4] not internal
> Jun 23 15:58:13 server opendkim[1364]: DE52181082: not authenticated
> Jun 23 15:58:13 server opendkim[1364]: DE52181082: DKIM verification
> successful
> Jun 23 15:58:13 server opendkim[1364]: DE52181082: s=20120113
> d=gmail.com SSL
> Jun 23 15:58:14 server postfix/qmgr[5941]: DE52181082:
> from=<u...@gmail.com>, size=2821, nrcpt=1 (queue active)
> Jun 23 15:58:14 server postfix/smtpd[6002]: disconnect from
> host35-4.82-193.overlinx.net[82.193.35.4]
> Jun 23 15:58:19 server postfix/smtpd[6023]: connect from
> localhost[127.0.0.1]
> Jun 23 15:58:19 server postfix/smtpd[6023]: BF8078040C:
> client=localhost[127.0.0.1]
> Jun 23 15:58:19 server postfix/cleanup[6009]: BF8078040C:
> message-id=<ca+za1hmsnhtfu-+vimq1h6r-gder5cvl0xonh+m4fchtgf6...@mail.gmail.com>
> Jun 23 15:58:19 server opendkim[1364]: BF8078040C: no signing table
> match for 'u...@gmail.com'
> Jun 23 15:58:19 server opendkim[1364]: BF8078040C: DKIM verification
> successful
> Jun 23 15:58:19 server opendkim[1364]: BF8078040C: s=20120113
> d=gmail.com SSL
> Jun 23 15:58:19 server postfix/qmgr[5941]: BF8078040C:
> from=<u...@gmail.com>, size=3522, nrcpt=1 (queue active)
> Jun 23 15:58:19 server postfix/smtpd[6023]: disconnect from
> localhost[127.0.0.1]
> Jun 23 15:58:19 server amavis[30901]: (30901-12) Passed CLEAN
> {RelayedInbound}, [82.193.35.4]:42447 [209.85.217.170] <u...@gmail.com>
> -> <m...@mydomain.it>, Queue-ID: DE52181082, Message-ID:
> <ca+za1hmsnhtfu-+vimq1h6r-gder5cvl0xonh+m4fchtgf6...@mail.gmail.com>,
> mail_id: x71Z1Zrxz2ac, Hits: -0.351, size: 2974, queued_as: BF8078040C,
> 5788 ms
> Jun 23 15:58:19 server postfix/smtp[6011]: DE52181082:
> to=<m...@mydomain.it>, relay=127.0.0.1[127.0.0.1]:10024, delay=6.2,
> delays=0.36/0/0/5.8, dsn=2.0.0, status=sent (250 2.0.0 from
> MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as BF8078040C)
> Jun 23 15:58:19 server postfix/qmgr[5941]: DE52181082: removed
> Jun 23 15:58:20 server postfix/lmtp[6024]: BF8078040C:
> to=<m...@mydomain.it>, relay=server.server.it[private/dovecot-lmtp],
> delay=0.24, delays=0.09/0/0/0.15, dsn=2.0.0, status=sent (250 2.0.0
> <m...@mydomain.it> wOVhNPtliVWJFwAAjE92vQ Saved)
> Jun 23 15:58:20 server postfix/qmgr[5941]: BF8078040C: removed 
> 
> And below when skip amavis check and match the rule: 
> 
> Jun 23 16:16:20 server postfix/smtpd[7446]: connect from
> host35-4.82-193.overlinx.net[82.193.35.4]
> Jun 23 16:16:21 server postfix/smtpd[7446]: Anonymous TLS connection
> established from host35-4.82-193.overlinx.net[82.193.35.4]: TLSv1.2 with
> cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
> Jun 23 16:16:21 server postfix/smtpd[7446]: 8342D80414:
> client=host35-4.82-193.overlinx.net[82.193.35.4]
> *Jun 23 16:16:21 server postfix/cleanup[7453]: 8342D80414: redirect:
> header Received: from mx69148.netaddiction.esp9.it
> (mx69148.netaddiction.esp9.it [93.174.69.148])??by
> ws1.intercomsolutions.it (Postfix) with ESMTP id 313C021480A??for
> <i...@mystart.it>; Tue, 23 Jun 2015 1 from
> host35-4.82-193.overlinx.net[82.193.35.4]; from=<b...@bounce.musvc.com>
> to=<m...@mydomain.it> proto=ESMTP helo=<ws1.intercomsolutions.it>:
> i...@mystart.it
> Jun 23 16:16:21 server postfix/cleanup[7453]: 8342D80414:
> message-id=<201506231616170246.2764.2...@musvc.com>
> Jun 23 16:16:21 server postfix/qmgr[6168]: 8342D80414:
> from=<b...@bounce.musvc.com>, size=60047, nrcpt=1 (queue active)
> Jun 23 16:16:21 server postfix/smtpd[7446]: disconnect from
> host35-4.82-193.overlinx.net[82.193.35.4]
> Jun 23 16:16:21 server postfix/lmtp[7456]: 8342D80414:
> to=<i...@mystart.it>, orig_to=<m...@mydomain.it>,
> relay=server.server.it[private/dovecot-lmtp], delay=0.7,
> delays=0.57/0.01/0/0.12, dsn=2.0.0, status=sent (250 2.0.0
> <i...@epservice.it> /2iALDVqiVUhHQAAjE92vQ Saved)
> Jun 23 16:16:21 server postfix/qmgr[6168]: 8342D80414: removed 
> 
> This is my rule in main.cf
> header_checks = regexp:/etc/postfix/header_checks 
> 
> and header_checks: 
> 
> /^To:.*i...@mystart.it*/ REDIRECT i...@mystart.it
> /^Received:.*i...@mystart.it*/ REDIRECT i...@mystart.it 
> 




Reply via email to