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

sendmail rule - firstname.lastname recognition

4 views
Skip to first unread message

Rainer Fuegenstein

unread,
Mar 12, 2002, 1:18:52 PM3/12/02
to
Hi,

We took over a domain (mydomain.at) and therefore are getting some
emails which we need to redirect, according to the following rule:

if the To: address is obviously "firstname...@mydomain.at" then
rewrite the To: address to "firstname...@mydomain.com" and deliver
it to the MX of mydomain.com. otherwise, apply all other rules as usual.

the best rule for recognition of "firstname.lastname" would be "if there
is a dot and there are at least 3 characters on the left side of the dot
and at least three characters between the dot and the @ then it is
firstname.lastname".

Has someone already written such a rule before ? a m4 macro would be
fine.

tnx in advance,
rainer.

Randy Schultz

unread,
Mar 12, 2002, 3:59:20 PM3/12/02
to
On Tue, 12 Mar 2002, Rainer Fuegenstein spaketh thusly:

-{Hi,
-{
-{We took over a domain (mydomain.at) and therefore are getting some
-{emails which we need to redirect, according to the following rule:
-{
-{if the To: address is obviously "firstname...@mydomain.at" then
-{rewrite the To: address to "firstname...@mydomain.com" and deliver
-{it to the MX of mydomain.com. otherwise, apply all other rules as usual.
-{
-{the best rule for recognition of "firstname.lastname" would be "if there
-{is a dot and there are at least 3 characters on the left side of the dot
-{and at least three characters between the dot and the @ then it is
-{firstname.lastname".
-{
-{Has someone already written such a rule before ? a m4 macro would be
-{fine.

AFAIK sendmail doesn't count letters like that. Rather, letters between
certain punctuation marks are put together in a token. To actually count
the letters you'll probably need a milter script. Otherwise this might
do the trick:
R$-.$-<@mydomain.at> $1.$2<@mydomain.com>

--
Randy (sch...@sgi.com) 715-726-2832 <*>

The Penguin Cometh

Per Hedeland

unread,
Mar 12, 2002, 6:11:48 PM3/12/02
to
In article <Pine.LNX.4.31.02031...@d3.americas.sgi.com>

Randy Schultz <sch...@sgi.com> writes:
>On Tue, 12 Mar 2002, Rainer Fuegenstein spaketh thusly:

>-{the best rule for recognition of "firstname.lastname" would be "if there


>-{is a dot and there are at least 3 characters on the left side of the dot
>-{and at least three characters between the dot and the @ then it is
>-{firstname.lastname".

>AFAIK sendmail doesn't count letters like that. Rather, letters between


>certain punctuation marks are put together in a token. To actually count
>the letters you'll probably need a milter script. Otherwise this might
>do the trick:
>R$-.$-<@mydomain.at> $1.$2<@mydomain.com>

Actually, counting the characters/letters (or rather, requiring a
minimum amount of them) could be done with a regex map, if it's really
needed - implementation left as an exercise etc...

--Per Hedeland
p...@bluetail.com

Rainer Fuegenstein

unread,
Mar 26, 2002, 8:14:06 AM3/26/02
to
Randy Schultz <sch...@sgi.com> wrote:

> the letters you'll probably need a milter script. Otherwise this might
> do the trick:
> R$-.$-<@mydomain.at> $1.$2<@mydomain.com>

big tnx, I crafted this rule into our mailhost.cf (m4):

FEATURE(nouucp,`reject')
FEATURE(`virtusertable', `btree -o /etc/mail/virtusertable')
[...]
MAILER(smtp)
LOCAL_RULE_2
# re-route sanofi emails
R$-.$- < @mydomain . at . > $1.$2<@mydomain.com>

problem now is that this sendmail config also uses a virtusertable with an
default address defined:

@mydomain.at us...@otherhost.at

I'm not sure to which ruleset the rule above should be added. It seems like only
rulesets 0 to 4 are supported in m4, and ruleset to seems to be to late since
when ruleset 2 is invoked the recipient's address is already us...@otherhost.at

could anybody please give me a hint on where to add this rule in a sendmail 8.11
config ? preferred order is:

ruleset 3 --> domain.at to domain.com rule --> virtusertable lookup --> etc.

tnx in advance.

--
------------------------------------------------------------------------------
Rainer Fuegenstein r...@iguwnext.tuwien.ac.at
------------------------------------------------------------------------------
"Why are you looking into the darkness and not into the fire as we do ?", Nell
asked. "Because the darkness is where danger comes from," Peter said, "and
from the fire comes only illusion". (from "The Diamond Age")
------------------------------------------------------------------------------

Per Hedeland

unread,
Mar 26, 2002, 4:31:05 PM3/26/02
to
In article <a7ps6u$77c$1...@news.tuwien.ac.at> Rainer Fuegenstein

<r...@kaneda.iguw.tuwien.ac.at> writes:
>FEATURE(nouucp,`reject')
>FEATURE(`virtusertable', `btree -o /etc/mail/virtusertable')
>[...]
>MAILER(smtp)
>LOCAL_RULE_2
># re-route sanofi emails
>R$-.$- < @mydomain . at . > $1.$2<@mydomain.com>
>
>problem now is that this sendmail config also uses a virtusertable with an
>default address defined:
>
>@mydomain.at us...@otherhost.at
>
>I'm not sure to which ruleset the rule above should be added. It seems like only
>rulesets 0 to 4 are supported in m4, and ruleset to seems to be to late since
>when ruleset 2 is invoked the recipient's address is already us...@otherhost.at
>
>could anybody please give me a hint on where to add this rule in a sendmail 8.11
>config ? preferred order is:
>
>ruleset 3 --> domain.at to domain.com rule --> virtusertable lookup --> etc.

LOCAL_RULE_0 should do the trick (it happpens just before the
virtusertable lookup).

--Per Hedeland
p...@hedeland.org

0 new messages