Sender rewriting

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

Sender rewriting

Daniel Bareiro
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all!

I am trying to configure my home Postfix so that the outgoing mail to an
external email from a user of my LAN are rewritten to a valid account of
mail, which would be to me especially useful if I would want to send
some type of notification to a external mail by means of a bash script.
I was trying of several ways but until the moment I did not obtain that
it worked to me.

In /etc/postfix/sender_canonical I tried with:

@*.myintra.net  [hidden email]

Having in /etc/postfix/main.cf:

sender_canonical_maps = regexp:/etc/postfix/sender_canonical

What syntax would have to use?

Thank in advance.

Regards,
Daniel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiLt1wACgkQZpa/GxTmHTeh2QCfekIdstrgaDGuF/QGHm3nIvsh
6J4AnAxFprkxzMLv/5keDS6Df++3/sLu
=SYnr
-----END PGP SIGNATURE-----

Reply | Threaded
Open this post in threaded view
|

Re: Sender rewriting

mouss-2
Daniel Bareiro wrote:
> Hi all!
>
> I am trying to configure my home Postfix so that the outgoing mail to an
> external email from a user of my LAN are rewritten to a valid account of
> mail, which would be to me especially useful if I would want to send
> some type of notification to a external mail by means of a bash script.

why not make the script send the message with
        sendmail -f $sender ...
?

the best way to solve a problem is to not create it in the first place.

> I was trying of several ways but until the moment I did not obtain that
> it worked to me.
>
> In /etc/postfix/sender_canonical I tried with:
>
> @*.myintra.net  [hidden email]
>
> Having in /etc/postfix/main.cf:
>
> sender_canonical_maps = regexp:/etc/postfix/sender_canonical

do not use sender_canonical_maps. use canonical_maps instead (rewrite
should be "symmetrical").

But in your case, you probably want smtp_generic_maps.

>
> What syntax would have to use?
>

you need to learn regexp. @* means one or more '@'. and '.' means any
character.

to rewrite any *@*.myintra.net (shell style expression), use
/@.*\.myintra\.net$/ [hidden email]

you should also read
        http://www.postfix.org/SOHO_README.html


Reply | Threaded
Open this post in threaded view
|

Re: Sender rewriting

Daniel Bareiro
On Sunday, 27 July 2008 17:29:41 +0200,
mouss wrote:

Hi mouss.

>> I am trying to configure my home Postfix so that the outgoing mail to
>> an external email from a user of my LAN are rewritten to a valid
>> account of mail, which would be to me especially useful if I would
>> want to send some type of notification to a external mail by means of
>> a bash script.

> why not make the script send the message with
>       sendmail -f $sender ...
> ?

It's a good possibility about which I had not thought. Thanks for this
tip.

>> I was trying of several ways but until the moment I did not obtain
>> that it worked to me.
>>
>> In /etc/postfix/sender_canonical I tried with:
>>
>> @*.myintra.net  [hidden email]
>>
>> Having in /etc/postfix/main.cf:
>>
>> sender_canonical_maps = regexp:/etc/postfix/sender_canonical

> do not use sender_canonical_maps. use canonical_maps instead (rewrite
> should be "symmetrical").

Mmmm... and, in case of using this table, how it would be the writing in
the inverse sense considering that of a side we are using generic
domains directions?

> But in your case, you probably want smtp_generic_maps.

>> What syntax would have to use?

> you need to learn regexp. @* means one or more '@'. and '.' means any
> character.
>
> to rewrite any *@*.myintra.net (shell style expression), use
> /@.*\.myintra\.net$/          [hidden email]

> you should also read
>       http://www.postfix.org/SOHO_README.html

Great! It works! But in the Postfix logs I don't see that sender is
rewritten; the outgoing mail has the user in the local domain. But even
so the relay server take it like a valid user. How it makes the
rewriting?

Thanks for your reply.

Regards,
Daniel
--
Daniel Bareiro - GNU/Linux registered user #188.598
Proudly running Debian GNU/Linux with uptime:
18:21:36 up 1 day, 19:37, 13 users,  load average: 0.05, 0.03, 0.00

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sender rewriting

mouss-2
In reply to this post by mouss-2
mouss wrote:
>
>
> you need to learn regexp. @* means one or more '@'.

oops. zero or more not one or more...