[Mailman-Developers] Fixing DMARC problems with .invalid munge
Mark Sapiro
mark at msapiro.net
Sat May 17 19:19:41 CEST 2014
On 05/16/2014 10:56 PM, Bob Puff wrote:
>
>> name, addrs = parseaddr(msg.get('from'))
>> addrs += '.invalid'
>> del msg['from']
>> msg['From'] = formataddr((name, addrs))
>>
>> If you put it in Mailman/Handlers/Cleanse.py or
>> Mailman/Handlers/CookHeaders.py, parseaddr and formataddr are already
>> imported from email.Utils so the above 4 lines added to the
>> process(mlist, msg, msgdata) function are all you need.
>
> Hey Mark,
>
> I'm getting: NameError: global name 'parseaddr' is not defined
> Should something else be imported?
You need
from email.Utils import parseaddr, formataddr
I said Cleanse.py and Cookheaders.py already contains this, but pre
2.1.16 versions of Cleanse.py only have
from email.Utils import formataddr
so if you're using Cleanse.py, add ', parseaddr' to that.
--
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Developers
mailing list