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

rewrite recipient address with help of regex

55 views
Skip to first unread message

hoyte....@gmail.com

unread,
Mar 2, 2009, 10:27:36 AM3/2/09
to
sendmail 8.14.3
i can use regex to deliver mail from specific recipients to one
generic local user,
however on port 25 the rcpt is not accepted with a "User unknown"
how can i accept variable usernames so i can map them to a local
generic user?
basically is want to extend plussed users what a minus as well as a
plus for seperator.
any help appreciated
thanks in advance
regards
hoyte


$ tail sendmail.mc
...
dnl
----------------------------------------------------------------------------
LOCAL_CONFIG
Kcheckaddress regex -a@MATCH ^genericuser[+-]
somevariablestring<@mydomain.com.>
dnl
----------------------------------------------------------------------------
LOCAL_RULESETS
SLocal_check_mail
R$* $: $>Parse0 $>3 $1
R$+ $: $(checkaddress $1 $)
R@MATCH $#local $: genericuser
dnl
----------------------------------------------------------------------------


$ sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> Local_check_mail <genericuser-som...@mydomain.com>
Local_check_mail input: < user-somevariablestring @ mydomain . com >
canonify input: < user-somevariablestring @ mydomain . com >
Canonify2 input: user-somevariablestring < @ mydomain . com >
Canonify2 returns: user-somevariablestring < @ mydomain . com .
>
canonify returns: user-somevariablestring < @ mydomain . com .
>
Parse0 input: user-somevariablestring < @ mydomain . com .
>
Parse0 returns: user-somevariablestring < @ mydomain . com .
>
Local_check_mail returns: $# local $: genericuser


$ telnet mail.mydomain.com 25
Trying 1.2.3.4...
Connected to mail.mydomain.com.
Escape character is '^]'.
220 mail.mydomain.com ESMTP; Mon, 2 Mar 2009 16:08:40 +0100
helo test
250 mail.mydomain.com Hello test [127.0.0.1], pleased to meet you
mail from: <myu...@mydomain.com>
250 2.1.0 <myu...@mydomain.com>... Sender ok
rcpt to: <genericuser-som...@mydomain.com>
550 5.1.1 <genericuser-som...@mydomain.com>... User
unknown
quit
221 2.0.0 mail.mydomain.com closing connection
Connection closed by foreign host.

Andrzej Adam Filip

unread,
Mar 2, 2009, 10:47:50 AM3/2/09
to
hoyte....@gmail.com wrote:

> [...]

Rewrite '-' separator to '+' separator and allow sendmail handle
deliveries to 'user+detail' as usual (with 'user' as the final try).

LOCAL_CONFIG
Kplus regex -s1,2 -d+ ^(genericsuser)-([0-9a-z]{1,32})$
LOCAL_RULE_0
R$+ <@$=w.> $* $: $(plus $1 $: $1 $) <@$2.> $3


http://groups.google.com/group/comp.mail.sendmail/msg/6c92c14e01082f5e?dmode=source
From: Andrzej Filip <a...@priv.onet.pl>
Newsgroups: comp.mail.sendmail
Subject: Re: Handling sites that don't support plussed addressing
Date: Wed, 22 Oct 2003 09:49:00 +0000
Message-ID: <bn5fr8$6uh$1...@anfi.freeshell.org>

--
[pl>en Andrew] Andrzej Adam Filip : an...@onet.eu : an...@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
Linux: Where Don't We Want To Go Today?
-- Submitted by Pancrazio De Mauro, paraphrasing some well-known sales talk

hoyte....@gmail.com

unread,
Mar 2, 2009, 11:07:23 AM3/2/09
to
On 2 Mar, 15:47, Andrzej Adam Filip <a...@onet.eu> wrote:
> http://groups.google.com/group/comp.mail.sendmail/msg/6c92c14e01082f5...

>   From: Andrzej Filip <a...@priv.onet.pl>
>   Newsgroups: comp.mail.sendmail
>   Subject: Re: Handling sites that don't support plussed addressing
>   Date: Wed, 22 Oct 2003 09:49:00 +0000
>   Message-ID: <bn5fr8$6u...@anfi.freeshell.org>
>
> --
> [pl>en Andrew] Andrzej Adam Filip : a...@onet.eu : a...@xl.wp.pl

> Open-Sendmail:http://open-sendmail.sourceforge.net/
> Linux: Where Don't We Want To Go Today?
>   -- Submitted by Pancrazio De Mauro, paraphrasing some well-known sales talk

whoah! that was quick
thx a lot, it works and is much cleaner this way
i did not know you could use regex within the user field only
something learned, something gained... ;-)
thx again
regards
hoyte

0 new messages