Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MAIL FROM rewriting per smtp client IP

443 views
Skip to first unread message

Peter Micunek

unread,
Feb 8, 2011, 8:20:21 AM2/8/11
to
Hi All,

I need to rewrite the envelope field "MAIL FROM:" but only for emails which come
from particular smtp client IP.
Is there any possibility how to do it?

Regards,
Peter Micunek

-----------------------------------------------
Stavebna fakulta STU, Bratislava
Faculty of Civil Engineering STU, Bratislava
http://www.svf.stuba.sk

Wietse Venema

unread,
Feb 8, 2011, 8:24:17 AM2/8/11
to
Peter Micunek:

> Hi All,
>
> I need to rewrite the envelope field "MAIL FROM:" but only for
> emails which come
> from particular smtp client IP.
> Is there any possibility how to do it?

Can you describe the problem, instead of the solution (per
client rewriting)?

Wietse

Peter Micunek

unread,
Feb 8, 2011, 9:08:11 AM2/8/11
to
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.

I need to do because these emails is routed via transport map to the
destination (MMS center)
which have policy based on MAIL FROM: domain. I can not allow all domains on
MMSC.

regards,
PM

On Tue, 8 Feb 2011 08:24:17 -0500 (EST), Wietse Venema wrote

Wietse Venema

unread,
Feb 8, 2011, 9:34:52 AM2/8/11
to
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.

Wietse

Noel Jones

unread,
Feb 8, 2011, 9:58:54 AM2/8/11
to
On 2/8/2011 8:08 AM, Peter Micunek wrote:
> 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.
>
> I need to do because these emails is routed via transport map to the
> destination (MMS center)
> which have policy based on MAIL FROM: domain. I can not allow all domains on
> MMSC.
>


If you are unable to properly configure the sending client,
have your transport map route to a different postfix instance
that uses virtual_alias_maps to rewrite the sender, then the
second postfix instance can use its own transport_maps to
route to the final destination.
http://www.postfix.org/MULTI_INSTANCE_README.html

-- Noel Jones

Wietse Venema

unread,
Feb 8, 2011, 10:26:19 AM2/8/11
to
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

Peter Micunek

unread,
Feb 8, 2011, 11:31:55 AM2/8/11
to
Wietse,

It seems that you helped me.

Thanks a lot

PM

On Tue, 8 Feb 2011 10:26:19 -0500 (EST), Wietse Venema wrote

Wietse Venema

unread,
Feb 8, 2011, 2:01:43 PM2/8/11
to
Peter Micunek:

> Wietse,
>
> It seems that you helped me.
>
> Thanks a lot

Good. for posteriority, the examples below uses smtp_header_checks
syntax instead of smtp_generic_checks syntax. Either feature should
do the job, when used appropriately.

Wietse

Victor Duchovni

unread,
Feb 8, 2011, 3:35:57 PM2/8/11
to
On Tue, Feb 08, 2011 at 02:01:43PM -0500, Wietse Venema wrote:

> Good. for posteriority, the examples below uses smtp_header_checks
> syntax instead of smtp_generic_checks syntax. Either feature should
> do the job, when used appropriately.

That would be smtp_generic_maps of course, which rewrites header
addresses, using a more complete parser than can be shoe-horned into
PCRE regular expressions.

--
Viktor.

Akshay Hegde

unread,
Jul 26, 2023, 11:50:39 PM7/26/23
to
I understand this post is decade old post, same methodology shown in trailing email worked for me till postfix ( version: mail_version = 2.7.8 on zimbra 7.2.0 ), but on version mail_version = 3.6.1 (Zimbra 8.8.15), its not working, I ensured that content_filter is null.

Any changes ?

Jerry Lee Daniel

unread,
Nov 21, 2023, 4:58:38 PM11/21/23
to
MT103/202 DIRECT WIRE TRANSFER
PAYPAL TRANSFER
CASHAPP TRANSFER
ZELLE TRANSFER
TRANSFER WISE
WESTERN UNION TRANSFER
BITCOIN FLASHING
BANK ACCOUNT LOADING/FLASHING
IBAN TO IBAN TRANSFER
MONEYGRAM TRANSFER
IPIP/DTC
SLBC PROVIDER
CREDIT CARD TOP UP
DUMPS/ PINS
SEPA TRANSFER
WIRE TRANSFER
BITCOIN TOP UP
GLOBALPAY INC US
SKRILL USA
UNIONPAY RECEIVER

Thanks.


NOTE; ONLY SERIOUS / RELIABLE RECEIVERS CAN CONTACT.

DM ME ON WHATSAPP
+44 7405 896213
Email: danielj...@mail.com

JAAK-KRIST JAN

unread,
Nov 26, 2023, 8:18:13 PM11/26/23
to
MT103/202 DIRECT WIRE TRANSFER
PAYPAL TRANSFER
CASHAPP TRANSFER
ZELLE TRANSFER
LOAN DEAL
TRANSFER WISE
WESTERN UNION TRANSFER
BITCOIN FLASHING
BANK ACCOUNT LOADING/FLASHING
IBAN TO IBAN TRANSFER
MONEYGRAM TRANSFER
IPIP/DTC
SLBC PROVIDER
CREDIT CARD TOP UP
DUMPS/ PINS
SEPA TRANSFER
WIRE TRANSFER
BITCOIN TOP UP
GLOBALPAY INC US
SKRILL USA
UNIONPAY RECEIVER

Thanks.


NOTE; ONLY SERIOUS / RELIABLE RECEIVERS CAN CONTACT.

DM ME ON WHATSAPP
+37256042146
0 new messages