Redirect all email to an external address

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Redirect all email to an external address

Martin LEUSCH
Hi,

I'm trying to create postfix master process listening on port 2525 and
redirect all email send trough this port to an external address.

I create regexp table "/etc/postfix/canonical-redirect-test" to map any
address to the external address I want, test query with postmap return
the expected address.

/^.+@.+$/     [hidden email]

I add new process in /etc/postfix/master.cf

:2525 inet n     -       n       -       -   smtpd
     -o canonical_maps=regexp:/etc/postfix/canonical-redirect-test
     -o virtual_alias_maps=regexp:/etc/postfix/canonical-redirect-test

I also try other settings with "recipient_canonical_maps" or
"virtual_maps" but email are always send to the original recipient
address and not to [hidden email].

Thanks,


Reply | Threaded
Open this post in threaded view
|

Re: Redirect all email to an external address

Wietse Venema
Martin LEUSCH:

> Hi,
>
> I'm trying to create postfix master process listening on port 2525 and
> redirect all email send trough this port to an external address.
>
> I create regexp table "/etc/postfix/canonical-redirect-test" to map any
> address to the external address I want, test query with postmap return
> the expected address.
>
> /^.+@.+$/     [hidden email]
>
> I add new process in /etc/postfix/master.cf
>
> :2525 inet n     -       n       -       -   smtpd
>      -o canonical_maps=regexp:/etc/postfix/canonical-redirect-test
>      -o virtual_alias_maps=regexp:/etc/postfix/canonical-redirect-test

The canonical and virtual_alias mappings are implemented
in the cleanup daemon, not smtpd.

/etc/postfix/master.cf:
    :2525 inet n     -       n       -       -   smtpd
        -o cleanup_service=cleanup_2525
    cleanup_2525 unix  n -   n       -       0   cleanup
        -o canonical_maps=regexp:/etc/postfix/canonical-redirect-test
        -o virtual_alias_maps=regexp:/etc/postfix/canonical-redirect-test

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Redirect all email to an external address

Martin LEUSCH
Thanks for your answer, it help me a lot. There was just a little error,
the correct option to put in smtpd process is "cleanup_service_name". I
also modify options for address rewriting to only modify the recipient
address in envelope and keep sender and addresses in header unchanged:

:2525 inet n     -       n       -       -   smtpd -v
     -o cleanup_service_name=cleanup_2525
cleanup_2525 unix  n -   n       -       0   cleanup -v
     -o canonical_classes=envelope_recipient
     -o canonical_maps=regexp:/etc/postfix/canonical-redirect-test

Le 19/06/2018 à 17:38, Wietse Venema a écrit :

> Martin LEUSCH:
>> Hi,
>>
>> I'm trying to create postfix master process listening on port 2525 and
>> redirect all email send trough this port to an external address.
>>
>> I create regexp table "/etc/postfix/canonical-redirect-test" to map any
>> address to the external address I want, test query with postmap return
>> the expected address.
>>
>> /^.+@.+$/     [hidden email]
>>
>> I add new process in /etc/postfix/master.cf
>>
>> :2525 inet n     -       n       -       -   smtpd
>>       -o canonical_maps=regexp:/etc/postfix/canonical-redirect-test
>>       -o virtual_alias_maps=regexp:/etc/postfix/canonical-redirect-test
> The canonical and virtual_alias mappings are implemented
> in the cleanup daemon, not smtpd.
>
> /etc/postfix/master.cf:
>      :2525 inet n     -       n       -       -   smtpd
> -o cleanup_service=cleanup_2525
>      cleanup_2525 unix  n -   n       -       0   cleanup
> -o canonical_maps=regexp:/etc/postfix/canonical-redirect-test
> -o virtual_alias_maps=regexp:/etc/postfix/canonical-redirect-test
>
> Wietse