address rewriting

address rewriting

am 30.08.2005 13:01:03 von hehaka

Hello,
I have following problem:
I'd like to configure sendmail to run process /usr/local/myprog with an
email message as parameter, when it'll reiceive email to addresses like
01234567890@domain.com (eleven digits and @domain.com). I suppose I
have to do it with rewriting rules and regular expressions, but I'm not
sure. Can someone help me?

Grtx,
Boguslaw

Re: address rewriting

am 30.08.2005 22:47:47 von Matej Vela

On 2005-08-30, hehaka@wp.pl wrote:
> I'd like to configure sendmail to run process /usr/local/myprog with an
> email message as parameter, when it'll reiceive email to addresses like
> 01234567890@domain.com (eleven digits and @domain.com). I suppose I
> have to do it with rewriting rules and regular expressions, but I'm not
> sure.

Yes, you need rules that resolve matching addresses to a myprog mailer:

LOCAL_CONFIG
Kphone regex -m -a@MATCH ^[0-9]{11}$

LOCAL_RULE_0
R$+ < @ domain.com. > $: $(phone $1 $) < @ domain.com. >
R$+ @ MATCH < @ domain.com. > $#myprog $: $1

MAILER_DEFINITIONS
Mmyprog, P=/usr/local/myprog, F=lsDFMqeu9,
S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
T=X-Unix/X-Unix/X-Unix,
A=myprog $u

Precede $: and $# with tabs. You may need to adjust the mailer
definition; see section 5.4 of the Operation Guide.

Re: address rewriting

am 31.08.2005 13:11:03 von hehaka

Thank you,
I have one problem with that solution.
For testing I used a rule:

LOCAL_RULE_0
R$+ < @ domain.com. > $: $(phone $1 $) < @ domain.com. >
R$+ @ MATCH < @ domain.com. > $: user@domain.com

when I use
sendmail - bt
3,0 12345678900@domain.com

It answers properly , but when I try to send an email message to
address 12345678900@domain.com , an email server answers the following
recepient could not be reached.

Could you tell me what's wrong,
Boguslaw

Re: address rewriting

am 31.08.2005 13:41:38 von Andrzej Adam Filip

hehaka@wp.pl writes:

> Thank you,
> I have one problem with that solution.
> For testing I used a rule:
>
> LOCAL_RULE_0
> R$+ < @ domain.com. > $: $(phone $1 $) < @ domain.com. >
> R$+ @ MATCH < @ domain.com. > $: user@domain.com
>
> when I use
> sendmail - bt
> 3,0 12345678900@domain.com
>
> It answers properly , but when I try to send an email message to
> address 12345678900@domain.com , an email server answers the following
> recepient could not be reached.
>
> Could you tell me what's wrong,

What is reported by sendmail in the log file?

--
Andrzej [en:Andrew] Adam Filip anfi@priv.onet.pl anfi@xl.wp.pl
http://www.sendmail.org/faq/ http://anfi.homeunix.net/sendmail/

Re: address rewriting

am 31.08.2005 15:22:27 von hehaka

I've changed second rule from
R$+ @ MATCH < @ domain.com. > $: user@domain.com
to
R$+ @ MATCH < @ domain.com. > $: user < @ domain.com. >

and it started to work.

I've got one more question:
Do you know any trick to send email to delivery agent like that:
R$+ @ MATCH < @ domain.com. > $#myprog $: $1

and leave the copy of email in mailbox?

Thanks,
Boguslaw