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

rewrite sender

119 views
Skip to first unread message

Denis

unread,
Aug 19, 2005, 5:31:32 AM8/19/05
to
hello, i've a strange question:
i want to rewrite the sender of an email
when the recipient is a particular address
that aren't one of my virtual users...
what can i do to do this?
thanks in advance...
--

Mandi,
denis

Magnus Bäck

unread,
Aug 19, 2005, 5:34:42 AM8/19/05
to
On Friday, August 19, 2005 at 11:31 CEST,
Denis <sin...@email.it> wrote:

> i want to rewrite the sender of an email when the recipient
> is a particular address that aren't one of my virtual users...
> what can i do to do this?

Postfix does not support such conditional rewriting, and implementing
this would require multiple Postfix instances. What problem are you
trying to solve?

--
Magnus Bäck
mag...@dsek.lth.se

Denis

unread,
Aug 19, 2005, 6:09:05 AM8/19/05
to
On Friday 19 August 2005 11:34, Magnus Bäck wrote:

> Postfix does not support such conditional rewriting, and implementing
> this would require multiple Postfix instances. What problem are you
> trying to solve?

i can send an email to: $my_mobile_number@$my_mobile_operator
which its content is sent to my mobile telephone trough an SMS.
but my mobile operator accept mail coming only from
my email address. and so i've to rewrite the sender that can be root,
or any other user, to my email address and then send the email to that
address....

--

denis

--

Mandi,
denis

Magnus Bäck

unread,
Aug 19, 2005, 6:17:36 AM8/19/05
to
On Friday, August 19, 2005 at 12:09 CEST,
Denis <sin...@email.it> wrote:

Deliver messages to a custom script that submits a new message with
the correct sender (and any other modifications that might be needed).
A local alias would probably be the easiest way to implement this:

denismobile: |/path/to/script

If you want to keep the recipient address at
$my_mobile_number@$my_mobile_operator, you can use a virtual alias
to rewrite that recipient address to the local alias:

$my_mobile_number@$my_mobile_operator denismobile@localhost

There is a lesson here: Always give the full picture by explaining
what problem you want solved rather than requesting help with a narrow
problem that might not make sense.

--
Magnus Bäck
mag...@dsek.lth.se

Denis

unread,
Aug 19, 2005, 7:36:30 AM8/19/05
to
On Friday 19 August 2005 12:17, Magnus Bäck wrote:

> There is a lesson here: Always give the full picture by explaining
> what problem you want solved rather than requesting help with a narrow
> problem that might not make sense.

thanks for the solutions and thanks for this phrases!!!
you're right!
another question: can you indicate me a script that
can i modify for that purpose, without that i wirte a new one?
thank you
ps: it's possible to concatenate instructions in a canonical (in this way):
denismobile: |/myscript | $my_mobile_number@_operator
or my script have to send itself new mail?
thanks again and sorry for my poor english

Magnus Bäck

unread,
Aug 19, 2005, 7:42:33 AM8/19/05
to
On Friday, August 19, 2005 at 13:36 CEST,
Denis <sin...@email.it> wrote:

> On Friday 19 August 2005 12:17, Magnus Bäck wrote:
>
> > There is a lesson here: Always give the full picture by explaining
> > what problem you want solved rather than requesting help with a
> > narrow problem that might not make sense.
>
> thanks for the solutions and thanks for this phrases!!!
> you're right!
> another question: can you indicate me a script that
> can i modify for that purpose, without that i wirte a new one?
> thank you

If you only need to change the envelope sender, you can just pipe the
message to sendmail(1) and specify a new envelope sender. You don't
even need a separate script for this:

denismobile: "|/usr/sbin/sendmail -f what...@example.com 12345@operator"

(Obviously replace the sendmail(1) with your actual path.)

> ps: it's possible to concatenate instructions in a canonical (in this way):
> denismobile: |/myscript | $my_mobile_number@_operator
> or my script have to send itself new mail?

You need to submit a new message.

--
Magnus Bäck
mag...@dsek.lth.se

Wietse Venema

unread,
Aug 20, 2005, 6:50:49 PM8/20/05
to
Denis:

1) Configure a transport map entry for the recipient domain
that gives the mail to a non-standard instance of the
Postfix SMTP client.

2) Use the generic_maps feature of Postfix 2.2 or later to
replace your sender by another one.

/etc/postfix/main.cf:
transport_maps=hash:/etc/postfix/transport

/etc/postfix/transport:
example.com mysmtp:

/etc/postfix/master.cf:
mysmtp unix - - n - - smtp
-o smtp_generic_maps=hash:/etc/postfix/generic

/etc/postfix/generic:
m...@mydomain.com h...@example.com

http://www.postfix.org/transport.5.html
http://www.postfix.org/master.5.html
http://www.postfix.org/generic.5.html
http://www.postfix.org/ADDRESS_REWRITING_README.html

Wietse

Ľubomír Brindza

unread,
May 31, 2012, 4:27:10 PM5/31/12
to
On Sunday, August 21, 2005 12:50:49 AM UTC+2, Wietse Venema wrote:
>
> 1) Configure a transport map entry for the recipient domain
> that gives the mail to a non-standard instance of the
> Postfix SMTP client.
>
> 2) Use the generic_maps feature of Postfix 2.2 or later to
> replace your sender by another one.
>
> /etc/postfix/main.cf:
> transport_maps=hash:/etc/postfix/transport
>
> /etc/postfix/transport:
> example.com mysmtp:
>
> /etc/postfix/master.cf:
> mysmtp unix - - n - - smtp
> -o smtp_generic_maps=hash:/etc/postfix/generic
>
> /etc/postfix/generic:
> m...@mydomain.com h...@example.com
>
> http://www.postfix.org/transport.5.html
> http://www.postfix.org/master.5.html
> http://www.postfix.org/generic.5.html
> http://www.postfix.org/ADDRESS_REWRITING_README.html
>
> Wietse

Sorry for resurrecting this.
This kind of conditional rewriting looks like exactly what I'm trying to do, but I've ran into problem I can't wrap my head around.

Everything seems to be configured allright: new transport, the corresponding entry in master.cf, and the generic rewrite table (and I didn't forget to postmap this time); but the messages stubbornly refuse to be overwritten. The transport itself is working OK (looking up maillog, also I managed to misconfigure it earlier and was getting deferred messages, all good now). When I bypass the transport and enable configure main.cf with `smtp_generic_maps=hash:/etc/postfix/generic' though, the sender is overwritten correctly (but for all recipients).

I have a sneaking suspicion amavis might have something to do with this. Any ideas?

(Also, sorry for resurrecting this! Should I make a new thread instead?)
0 new messages