On Fri, May 07, 2021 at 10:19:49AM -0400, Steve Dondley wrote:
> I want to extract the first part of an email address from the "Delivered-To"
> header and use it witin a custom rule.
> 
> Example pseudo code:
> 
> my ($first_part) = $email_file =~ /^Deliver-To: (.*)/;
> 
> body __LOCAL_AWKWARD_INTRO /hi $first_part/i
> 
> 
> How can I do this in my .cf file?

With a silly kludge, a full rule that matches the complete raw email with a
single regex.  Example in stock rules:

full __FROM_NAME_IN_MSG /^From:\s+([^<]\S+\s\S+)\s(?=.{1,2048}^\1\r?$)/sm

So something like (untested)

full __LOCAL_AWKWARD_INTRO 
/^Delivered-To:\s+<([^@>]+)(?=.{1,2048}\bHi\s+\1\b)/sm

If the raw message is Base64 encoded or such, it will never match.

Reply via email to