On Wed, Nov 12, 2014 at 05:56:38PM +0100, A. Schulze wrote:
>
> wietse:
> >/^(RCPT\s+TO:<.*>.*\s+NOTIFY=.*)/ $1
> >/^(RCPT\s+TO:<.*>.*)/ $1 NOTIFY=SUCCESS,DELAY,FAILURE
>
> the regex above don't match on 'RCPT TO: <[email protected]>' ( SPACE after
> colon )
Note the extra space violates RFCs 5321, 2821, 821. However, it
was historically accepted by Sendmail, and is accepted also by
Postfix as a compatibility crutch.
> I use now:
> /^(RCPT\s+TO:\s*<.*>.*\s+NOTIFY=.*)/ $1
> /^(RCPT\s+TO:\s*<.*>.*)/ $1 NOTIFY=SUCCESS,DELAY,FAILURE
So a cleaner approach might be:
/^RCPT\s+TO:\s*(<.*?>.*?)\s+(NOTIFY=.*)/ RCPT TO:$1 $2
/^RCPT\s+TO:\s*(<.*>.*)/ RCPT TO:$1 NOTIFY=SUCCESS,DELAY,FAILURE
[ Since vertical tabs, and other notional PCRE white-space characters
are not SMTP white-space, PCRE whitespace matched with "\s+" is
canonicalized to a space. ]
--
Viktor.