On 16Dec2014 15:23, Patrick asked me to provide a recipe for unmangling the "From:" headers of posts to list like sed-us...@yahoogroups.com which rewrite the "From:" headers of their posts to honour the rules of DMARC authentication.

The glaring example for me is the sed-us...@yahoogroups.com list, which moved to DKIM authentication last year, and as a consequence had to rewrite the From: headers on every outbound message to be from sed-users, not the author. For example, a post from me would arrive with this From: header:

 From: "Cameron Simpson c...@zip.com.au [sed-users]" <sed-us...@yahoogroups.com>

I now automatically reverse that on receipt.

As hoped, I've found time in the last week or so to:

 - upgrade my mailfiler tool to support a hdr:s/this/that/ header
   rewriting rule

 - use that to write a rule to unmangle sed-users posts, restoring
   correct From: headers to be the message author

 - pull that rule out into a sed script that can be used in procmail recipes

So here we go:

First up my mailfiler(1cs) rules. Mailfiler is a tool of my own which I use to file my email. You can track it here:

 https://bitbucket.org/cameron_simpson/css/commits/branch/mailfiler

I'm using these rules to file my sed-users email:

from:s/"(?P<fullname>.*\S)\s+(?P<coreaddr>\S+@\S+)\s+\[sed-users\]".*<sed-us...@yahoogroups.com>/"$fullname" <$coreaddr>/
                       sender:sed-us...@yahoogroups.com
                       from:/<sed-us...@yahoogroups.com>
 
from:s/"(?P<coreaddr>\S+@\S+)\s+\[sed-users\]".*<sed-us...@yahoogroups.com>/<$coreaddr>/
                       sender:sed-us...@yahoogroups.com
                       from:/<sed-us...@yahoogroups.com>
 sh      SedUsers      to,cc,sender,x-apparently-to:sed-us...@yahoogroups.com

Second, the sed script to do the same thing on suitable messages:

 https://bitbucket.org/cameron_simpson/css/src/tip/bin/fix-dkim-from

Finally, the matching procmailrc recipe (untested) to use in your own procmail recipes:

 :0whf
 * from:.*<sed-us...@yahoogroups.com>
 | fix-dkim-from

Questions, comments, requests welcomed!

Also, should this go in the wiki, and if so, where?

Cheers,
Cameron Simpson <c...@zip.com.au>

Microsoft Mail: as far from RFC-822 as you can get and still pretend to care.
       - Abby Franquemont-Guillory <abb...@tezcat.com>

Reply via email to