Wietse Venema:
> Peter Micunek:
> > Wietse,
> > 
> > problem is that I need to have one domain in the field "MAIL FROM:"
> > for all emails come from particular client for example 10.10.10.10
> > to my postfix server.  The mail header field "From:" will be
> > preserved.
> 
> You need to configure as follows:
> 
> 1) Configure Postfix to preserve the From: address in mail from
>    this client. For control over Postfix header rewriting, see:
>    http://www.postfix.org/postconf.5.html#local_header_rewrite_clients
> 
> 2) Configure the client to send mail with the "right" From:  address.
>    The details for doing this are specific to the client.

If (2) is not possible, you can use a null content filter instead,
where a customized Postfix SMTP client "replaces" the From: header
using PCRE regular expressions, and then sends the result directly
into a Postfix SMTP server on 127.0.0.1 port 10026.

/etc/postfix/main.cf:
    smtpd_client_restrictions = 
        check_client_access hash:/etc/postfix/client_access

/etc/postfix/client_access:
    10.10.10.10 FILTER foobar:127.0.0.1:10026

/etc/postfix/master.cf:
    foobar      unix  -       -       n       -       -       smtp
        -o smtp_generic_maps=pcre:/etc/postfix/foobar_generic.pcre
    127.0.0.1:10026 inet  n   -       n       -       -       smtpd
        -o receive_override_options=no_address_mappings,no_milters

/etc/postfix/foobar_generic.pcre:
    /^From: something/  REPLACE From: something

This assumes that you aren't already using FILTER for other purposes.

References:
http://www.postfix.org/FILTER_README.html
http://www.postfix.org/master.5.html
http://www.postfix.org/postconf.5.html#receive_override_options
http://www.postfix.org/postconf.5.html#smtp_generic_maps
http://www.postfix.org/generic.html
http://www.postfix.org/pcre_table.html

        Wietse

Reply via email to