[Remail] [RFC/RFT V2 patch 2/2] remail: Provide a less convoluted From: header mangling

Thomas Gleixner tglx at linutronix.de
Fri Jun 16 22:04:08 CEST 2023


On Fri, Jun 16 2023 at 15:31, Konstantin Ryabitsev wrote:

> On Tue, Jun 13, 2023 at 09:43:23PM +0200, Thomas Gleixner wrote:
>> --- a/Documentation/man5/remail.config.rst
>> +++ b/Documentation/man5/remail.config.rst
>> @@ -264,6 +264,7 @@ Base configuration items
>>        moderated:          True
>>        attach_sender_info: False
>>        set_original_from:  False
>> +      mangle_from_v2:     False
>
> I'm generally opposed to making this configurable -- let's just make this
> change the new behaviour. It's not the kernel and we don't need to remain 100%
> compatible with existing installs, especially when we know everyone running
> remail by name (probably).

Ok :)

> Everywhere I've seen that does From: mangling, it's always "Firstname Lastname
> via Mailing List", so I think you wouldn't hurt anyone's feelings if you 
>
>> +def get_name_and_email_addr(addr):
>> +    try:
>> +        name, addr = addr.split('<')
>> +    except:
>> +        name = ''
>> +    return name.strip(), addr.lstrip('<').rstrip('>')
>
> Believe it or not, there are ways in which this would fail. I recommend using
> email.utils.parseaddr(). E.g.:
>
>     In [1]: import email.utils as eu
>     In [2]: eu.parseaddr('"Foo <Angles> Bar" <foo at bar.baz>')
>     Out[2]: ('Foo <Angles> Bar', 'foo at bar.baz')

Thanks for the pointer!

       Thomas


More information about the Remail mailing list