On 2009-11-10 at 18:04 +0300, Vasiliy G Tolstov wrote:
> Hello.
> I have this regular expression to check Message-Id header
> [\S]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
>
> (* before @ and two words separated with dot after @)
>
> deny condition = ${if match
> {$h_Message-Id:}{[\S]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?} {1}}
> message = X-ACL-DATA: Invalid Message-Id
> log_message = X-ACL-DATA: Invalid Message-Id
>
> But if a send e-mail with aaa@test and aaa@??? all messages passed
> by this acl and delivery.
>
> pcretest work's fine with this expression
You need to wrap the regexp in \N....\N to protect escape sequences
inside it. Otherwise, the "\." is interpreted at the Exim string
expansion layer and becomes just "." in the regexp.
Generally, you can test by starting a test Exim daemon on a different
port, with debugging turned on via -d; you can test the string expansion
with -d+expand for more information. Eg, in one terminal run:
exim -d+expand -oX 26 -bd
and then connect to port 26 in a different window and type/paste in the
SMTP dialogue to send your test message.
Regards,
-Phil