address rewriting with regexp

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

address rewriting with regexp

Andy Smith-21
hello,

maybe someone here can help. I am trying to rewrite a certain set of  To address with regex when they are sent outbound from my mail server.

I am trying to do the following:

Can you rewrite this to  123456789@ smscountry.net to    [hidden email].

The number string is very dynamic and will be many different combinations.   


is there a way to do this with regex.  I have tried /@smscountry\.net/  .[hidden email] but this drops the number sequence.

Any help would be appreciated.

Andy
Reply | Threaded
Open this post in threaded view
|

Re: address rewriting with regexp

Noel Jones-2
On 2/10/2010 1:38 AM, Andy Smith wrote:

> hello,
>
> maybe someone here can help. I am trying to rewrite a certain set of  To
> address with regex when they are sent outbound from my mail server.
>
> I am trying to do the following:
>
> Can you rewrite this to  123456789@ smscountry.net
> <http://smscountry.net> to [hidden email]
> <mailto:[hidden email]>.
>
> The number string is very dynamic and will be many different combinations.
>
>
> is there a way to do this with regex.  I have tried /@smscountry\.net/
> .[hidden email] <mailto:[hidden email]> but this drops
> the number sequence.
>
> Any help would be appreciated.
>
> Andy

When posting from gmail, please click the [Plain Text] button.

To add the ".mydomain" tag to any number:
/^([0-9]+)@smscountry\.net$/  $[hidden email]

If you need to limit the rewriting to a specific set of
numbers, probably best to list each number individually.

   -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: address rewriting with regexp

Andy Smith-21
ok i have put that in canonical and when the rewrite occurs i get a
log that looks like this

Feb 10 16:52:45 dal1-svc-12 postfix/smtp[13697]: 9E4FA26FB8:
to=<[hidden email]>,
orig_to=<[hidden email]>,
relay=roslife.net.outbound15.mxlogic.net[208.65.144.92]:25, delay=2.2,
delays=0.56/0.01/0.09/1.5, dsn=2.0.0, status=sent (250 [OUTBOUND]
b54e27b4.0.89022.00-001.196464.p02c11o141.mxlogic.net QueueSafe)


my rewrite looks like

/^(.*)@smscountry\.net$/ $[hidden email]

am i missing something as prodea_uae1 is being added multiple times.



On Wed, Feb 10, 2010 at 10:43 AM, Noel Jones <[hidden email]> wrote:

>
> On 2/10/2010 1:38 AM, Andy Smith wrote:
>>
>> hello,
>>
>> maybe someone here can help. I am trying to rewrite a certain set of  To
>> address with regex when they are sent outbound from my mail server.
>>
>> I am trying to do the following:
>>
>> Can you rewrite this to  123456789@ smscountry.net
>> <http://smscountry.net> to [hidden email]
>> <mailto:[hidden email]>.
>>
>> The number string is very dynamic and will be many different combinations.
>>
>>
>> is there a way to do this with regex.  I have tried /@smscountry\.net/
>> .[hidden email] <mailto:[hidden email]> but this drops
>> the number sequence.
>>
>> Any help would be appreciated.
>>
>> Andy
>
> When posting from gmail, please click the [Plain Text] button.
>
> To add the ".mydomain" tag to any number:
> /^([0-9]+)@smscountry\.net$/  $[hidden email]
>
> If you need to limit the rewriting to a specific set of numbers, probably best to list each number individually.
>
>  -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: address rewriting with regexp

Bill Weiss-5
Andy Smith([hidden email])@Wed, Feb 10, 2010 at 11:01:05AM -0600:

> ok i have put that in canonical and when the rewrite occurs i get a
> log that looks like this
>
> Feb 10 16:52:45 dal1-svc-12 postfix/smtp[13697]: 9E4FA26FB8:
> to=<[hidden email]>,
> orig_to=<[hidden email]>,
> relay=roslife.net.outbound15.mxlogic.net[208.65.144.92]:25, delay=2.2,
> delays=0.56/0.01/0.09/1.5, dsn=2.0.0, status=sent (250 [OUTBOUND]
> b54e27b4.0.89022.00-001.196464.p02c11o141.mxlogic.net QueueSafe)
>
>
> my rewrite looks like
>
> /^(.*)@smscountry\.net$/ $[hidden email]
>
> am i missing something as prodea_uae1 is being added multiple times.

My guess is that you're hitting this:

The  optional canonical(5) table specifies an address map- ping for local
and non-local  addresses.  The  mapping  is used  by the cleanup(8)
daemon, before mail is stored into the queue.  The address mapping is
recursive.
^^^^^^^^^^

Try something like this:

/^([0-9]+)@smscountry\.net$/  $[hidden email]

--
Bill Weiss
Reply | Threaded
Open this post in threaded view
|

Re: address rewriting with regexp

Noel Jones-2
In reply to this post by Andy Smith-21
Please don't top-post.

On 2/10/2010 11:01 AM, Andy Smith wrote:

> ok i have put that in canonical and when the rewrite occurs i get a
> log that looks like this
>
> Feb 10 16:52:45 dal1-svc-12 postfix/smtp[13697]: 9E4FA26FB8:
> to=<[hidden email]>,
> orig_to=<[hidden email]>,
> relay=roslife.net.outbound15.mxlogic.net[208.65.144.92]:25, delay=2.2,
> delays=0.56/0.01/0.09/1.5, dsn=2.0.0, status=sent (250 [OUTBOUND]
> b54e27b4.0.89022.00-001.196464.p02c11o141.mxlogic.net QueueSafe)
>
>
> my rewrite looks like
>
> /^(.*)@smscountry\.net$/ $[hidden email]

Looks as if you decided to use .* in place of the suggested [0-9]+

>
> am i missing something as prodea_uae1 is being added multiple times.

Yes, address rewrites are recursive.  Maybe you should use my
version.

   -- Noel Jones



>
>
>
> On Wed, Feb 10, 2010 at 10:43 AM, Noel Jones<[hidden email]>  wrote:
>>
>> On 2/10/2010 1:38 AM, Andy Smith wrote:
>>>
>>> hello,
>>>
>>> maybe someone here can help. I am trying to rewrite a certain set of  To
>>> address with regex when they are sent outbound from my mail server.
>>>
>>> I am trying to do the following:
>>>
>>> Can you rewrite this to  123456789@ smscountry.net
>>> <http://smscountry.net>  to [hidden email]
>>> <mailto:[hidden email]>.
>>>
>>> The number string is very dynamic and will be many different combinations.
>>>
>>>
>>> is there a way to do this with regex.  I have tried /@smscountry\.net/
>>> .[hidden email]<mailto:[hidden email]>  but this drops
>>> the number sequence.
>>>
>>> Any help would be appreciated.
>>>
>>> Andy
>>
>> When posting from gmail, please click the [Plain Text] button.
>>
>> To add the ".mydomain" tag to any number:
>> /^([0-9]+)@smscountry\.net$/  $[hidden email]
>>
>> If you need to limit the rewriting to a specific set of numbers, probably best to list each number individually.
>>
>>   -- Noel Jones



Reply | Threaded
Open this post in threaded view
|

Re: address rewriting with regexp

Bill Weiss-5
In reply to this post by Bill Weiss-5
Bill Weiss([hidden email])@Wed, Feb 10, 2010 at 11:08:08AM -0600:

> Andy Smith([hidden email])@Wed, Feb 10, 2010 at 11:01:05AM -0600:
> > ok i have put that in canonical and when the rewrite occurs i get a
> > log that looks like this
> >
> > Feb 10 16:52:45 dal1-svc-12 postfix/smtp[13697]: 9E4FA26FB8:
> > to=<[hidden email]>,
> > orig_to=<[hidden email]>,
> > relay=roslife.net.outbound15.mxlogic.net[208.65.144.92]:25, delay=2.2,
> > delays=0.56/0.01/0.09/1.5, dsn=2.0.0, status=sent (250 [OUTBOUND]
> > b54e27b4.0.89022.00-001.196464.p02c11o141.mxlogic.net QueueSafe)
> >
> >
> > my rewrite looks like
> >
> > /^(.*)@smscountry\.net$/ $[hidden email]
> >
> > am i missing something as prodea_uae1 is being added multiple times.
>
> My guess is that you're hitting this:
>
> The  optional canonical(5) table specifies an address map- ping for local
> and non-local  addresses.  The  mapping  is used  by the cleanup(8)
> daemon, before mail is stored into the queue.  The address mapping is
> recursive.
> ^^^^^^^^^^

Sorry, that text is from canonical(5), as seen at
http://www.postfix.org/canonical.5.html

--
Bill Weiss

Reply | Threaded
Open this post in threaded view
|

Re: address rewriting with regexp

Andy Smith-21
On Wed, Feb 10, 2010 at 11:08 AM, Bill Weiss
<[hidden email]> wrote:

> Bill Weiss([hidden email])@Wed, Feb 10, 2010 at 11:08:08AM -0600:
>> Andy Smith([hidden email])@Wed, Feb 10, 2010 at 11:01:05AM -0600:
>> > ok i have put that in canonical and when the rewrite occurs i get a
>> > log that looks like this
>> >
>> > Feb 10 16:52:45 dal1-svc-12 postfix/smtp[13697]: 9E4FA26FB8:
>> > to=<[hidden email]>,
>> > orig_to=<[hidden email]>,
>> > relay=roslife.net.outbound15.mxlogic.net[208.65.144.92]:25, delay=2.2,
>> > delays=0.56/0.01/0.09/1.5, dsn=2.0.0, status=sent (250 [OUTBOUND]
>> > b54e27b4.0.89022.00-001.196464.p02c11o141.mxlogic.net QueueSafe)
>> >
>> >
>> > my rewrite looks like
>> >
>> > /^(.*)@smscountry\.net$/ $[hidden email]
>> >
>> > am i missing something as prodea_uae1 is being added multiple times.
>>
>> My guess is that you're hitting this:
>>
>> The  optional canonical(5) table specifies an address map- ping for local
>> and non-local  addresses.  The  mapping  is used  by the cleanup(8)
>> daemon, before mail is stored into the queue.  The address mapping is
>> recursive.
>> ^^^^^^^^^^
>
> Sorry, that text is from canonical(5), as seen at
> http://www.postfix.org/canonical.5.html
>
> --
> Bill Weiss
>
>

Noel,

Yes i should have used your way because it worked :)   Thanks for the assist.

Andy