I have an old mailing service that processes alphanumeric pager
email addresses that I'm trying to move to a sort of alias-based
service on another server. The problem I have is the old service
allows users to send mail to a sort of wildcard email address which
in turn has some software that deals with the translating of the
email address. I need to be able to maintain this backwards
compatibility but am having a difficult time coming up with a
solution.
I had originally planned to write a perl script and pipe some
aliases to that but I think it might be simpler to try and solve
this with some regex local rules in sendmail, if possible. I've
looked at Andrzej Filip's examples in previous posts and the basic
examples in the 'Sendmail Cookbook' but I haven't been able to come
up with the right regular expression(s) and rules to make this
work.
Can someone please help get me going in the right direction? Is
there an easier solution that I've overlooked?
Here is an explanation of the email address madness I'm dealing
with.
1. Someone sends an email to 123456...@host1.edu
2. I need to rewrite it to 91912...@host2.com
3. Forward the email to the rewritten email address
Thanks for any assistance you can provide.
Regards,
-Stephen
IF you want to investigate "perl option" further THEN take a look at
* socket map protocol, sample scripts are provided in contrib directory
of sendmail distribution [will require also a few custom *.mc lines]
*OR*
* MIMEDefang (perl based) milter, it can rewrite envelope recipients
It may be an overkill in your case unless you want to introduce much
more sophisticated checks than you seem to suggest later
(e.g. checks against full list of valid pager numbers).
> I've looked at Andrzej Filip's examples in previous posts and the
> basic examples in the 'Sendmail Cookbook' but I haven't been able to
> come up with the right regular expression(s) and rules to make this
> work.
>
> Can someone please help get me going in the right direction? Is
> there an easier solution that I've overlooked?
>
> Here is an explanation of the email address madness I'm dealing
> with.
>
> 1. Someone sends an email to 123456...@host1.edu
> 2. I need to rewrite it to 91912...@host2.com
> 3. Forward the email to the rewritten email address
>
> Thanks for any assistance you can provide.
*I HAVE NOT TESTED IT PROPERLY. USE AT YOUR OWN RISK*
Take a look at the sample below
LOCAL_CONFIG
Kd7 regex ^[0-9]{7}$$
LOCAL_RULE_0
# Canonify (in case of DNS resolution problems)
R$+ <@host1.edu> $: $1 <@host1.edu.>
# do the regex lookup
R$-.pager <@host1.edu.> $: <$(d7 $1 $: NOMATCH $)> $1.pager <@host1.edu.>
# rewrite as it was in case of no match
R<$+> $-.pager <@host1.edu.> $: $2.pager<@host1.edu.>
# rewrite matching addresses
R<> $-.pager <@host1.edu.> $: $(dequote 919 "" $1 $) <@host2.com.>
For testing use the commands below (simple check, detailed check):
echo '3,0 123456...@host1.edu' | sendmail -bt
echo '3,0 123456...@host1.edu' | sendmail -bt -d21.12 -d60.1
--
[pl>en: Andrew] Andrzej Adam Filip : an...@priv.onet.pl : an...@xl.wp.pl
http://anfi.homeunix.net/sendmail/ http://www.linkedin.com/in/andfil
Before You Ask: http://anfi.homeunix.net/sendmail/B4UAsk-Sendmail.html
> IF you want to investigate "perl option" further THEN take a look at
> * socket map protocol, sample scripts are provided in contrib directory
> of sendmail distribution [will require also a few custom *.mc lines]
> *OR*
> * MIMEDefang (perl based) milter, it can rewrite envelope recipients
I'm actually already using MIMEDefang for something else on this server
but I didn't want to have to deal with the extra overhead, since MIMEDefang
is already doing other processing, if I didn't have to. Thanks for the
tip about using it, though. It gives me some ideas for some other things
I need to get done.
> Take a look at the sample below
>
> LOCAL_CONFIG
> Kd7 regex ^[0-9]{7}$$
> LOCAL_RULE_0
> # Canonify (in case of DNS resolution problems)
> R$+ <@host1.edu> $: $1 <@host1.edu.>
> # do the regex lookup
> R$-.pager <@host1.edu.> $: <$(d7 $1 $: NOMATCH $)> $1.pager <@host1.edu.>
> # rewrite as it was in case of no match
> R<$+> $-.pager <@host1.edu.> $: $2.pager<@host1.edu.>
> # rewrite matching addresses
> R<> $-.pager <@host1.edu.> $: $(dequote 919 "" $1 $) <@host2.com.>
Awesome! This works perfectly! Thanks so much for rule.
Regards,
-Stephen
> LOCAL_CONFIG
> Kd7 regex ^[0-9]{7}$$
> LOCAL_RULE_0
> # Canonify (in case of DNS resolution problems)
> R$+ <@host1.edu> $: $1 <@host1.edu.>
> # do the regex lookup
> R$-.pager <@host1.edu.> $: <$(d7 $1 $: NOMATCH $)> $1.pager <@host1.edu.>
> # rewrite as it was in case of no match
> R<$+> $-.pager <@host1.edu.> $: $2.pager<@host1.edu.>
> # rewrite matching addresses
> R<> $-.pager <@host1.edu.> $: $(dequote 919 "" $1 $) <@host2.com.>
Thanks for putting up with my lazy question.
Grant. . . .
> Andrzej Adam Filip wrote:
>
>> IF you want to investigate "perl option" further THEN take a look at
>> * socket map protocol, sample scripts are provided in contrib directory
>> of sendmail distribution [will require also a few custom *.mc lines]
>> *OR*
>> * MIMEDefang (perl based) milter, it can rewrite envelope recipients
>
> I'm actually already using MIMEDefang for something else on this server
> but I didn't want to have to deal with the extra overhead, since MIMEDefang
> is already doing other processing, if I didn't have to. Thanks for the
> tip about using it, though. It gives me some ideas for some other things
> I need to get done.
IMHO the extra would be negligible.
>> Take a look at the sample below
>>
>> LOCAL_CONFIG
>> Kd7 regex ^[0-9]{7}$$
>> LOCAL_RULE_0
>> # Canonify (in case of DNS resolution problems)
>> R$+ <@host1.edu> $: $1 <@host1.edu.>
>> # do the regex lookup
>> R$-.pager <@host1.edu.> $: <$(d7 $1 $: NOMATCH $)> $1.pager <@host1.edu.>
>> # rewrite as it was in case of no match
>> R<$+> $-.pager <@host1.edu.> $: $2.pager<@host1.edu.>
>> # rewrite matching addresses
>> R<> $-.pager <@host1.edu.> $: $(dequote 919 "" $1 $) <@host2.com.>
>
> Awesome! This works perfectly! Thanks so much for rule.
As I wrote *TEST IT* :-)
P.S.
Do you know how to make trn support non ascii charsets?
I know somebody needing it. Reply off the newsgroup