[exim] Here's some useful ACLs for From header

Top Page
Delete this message
Reply to this message
Author: Marc Perkel
Date:  
To: exim-users
Subject: [exim] Here's some useful ACLs for From header
Here's what should be some useful ACLs to break down elements of the
From header into the name part, email part, and domain part.

I'm planning to post these on the Wiki as examples. Perhaps someone
would check and optimize the regex befor I post it. I'm not the best at
regex.

# Extract the name part of the from address ("Name Part"
<Email@???>)
# into $acl_c_from_name_part returning [Name Part]

warn    set acl_c_from_name_part = 
${sg{$h_From:}{\N^["]?(.*?)\s?["]?\s?<.*$\N}{\$1}}


# Extract the email part of the from address ("Name Part"
<Email@???>)
# into $acl_c_from_email_part returning [email@???]

warn    set acl_c_from_email_part = 
${lc:${sg{$h_From:}{\N^.*<(.*)>$\N}{\$1}}}


# Extract the email domain part of the from address ("Name Part"
<Email@???>)
# into $acl_c_from_domain_part returning [address.com]

warn    set acl_c_from_domain_part = 
${sg{$acl_c_from_email_part}{\N^.*@(.*)$\N}{\$1}}