Re: [exim] Extract email address from From header

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Phil Pennock
Data:  
Para: Elliot Murdock
CC: exim-users
Asunto: Re: [exim] Extract email address from From header
On 2010-10-30 at 18:26 +0200, Elliot Murdock wrote:
> I've managed to use the set command to give acl_c) the value of the
> email address in From header but putting this line in the acl:
>
> set acl_c0 = ${if
> match{$header_From:}{\([a-z,A-Z,\\.,\\-]+@[a-z,A-Z,\\.,\\-]+\)}{$1}}
>
> However, I guess using the ${addresses} expansion operator would be
> more conventional.


More importantly, less buggy.

You've matched comma multiple times in that regexp, but character
classes don't take comma-separated ranges, so you're accepting commas in
the domain, as well as in the LHS, where they're not valid unless
quoted. In addition, you're not accepting many valid characters for the
LHS, such as '+', '=', etc. Rather than enumerate these, you might want
to look at RFCs 5321 and 5322 (for the atext & qtext productions).

And that's still not getting into parsing out the address properly from
display form, merely something less buggy, but still not as close as
${addresses:...}

-Phil