Hi,
I'm having some trouble with matching. The regexp in my dovecot.sieve file should match on email addresses, but does not.
# The code: if header :matches "From" "<[a-z0-9-]*@[a-z0-9-.]*>" { set "sender" "${1}"; } if not execute "grepfrom" ["${sender}"] { if envelope :matches "from" "*" { set "sender" "${1}"; }
This failes to match Tamara Denning <tdenning@cs.utah.edu> when I check that regexp against that string at regex101.com, it shows a match, but the log (from sieve-test) shows:
348: header test
348: starting :matches' match with
i;ascii-casemap' comparator:
348: extracting From' headers from message 348: matching value
Tamara Denning <tdenning@cs.utah.edu>'
348: with key `.*<[a-z0-9-]*@[a-z0-9-.]*>' => 0
348: finishing match with result: not matched
I would appreciate advice on why the match is failing, or what I can change to make it match.
Thank you!
Adam
On 2020-02-26 11:20 a.m., Adam Shostack wrote:
if header :matches "From" "<[a-z0-9-]*@[a-z0-9-.]*>" { set "sender" "${1}"; }
- you need :regex instead of :matches
- you need "require regex"
- there is nothing to match the variable ${1} in your regex. missing () See: https://tools.ietf.org/id/draft-ietf-sieve-regex-01.html
participants (2)
-
Adam Shostack
-
Oscar del Rio