mailparse
mailparse copied to clipboard
Add functions to parse List-Id
List-Id is defined in RFC 2919.
A header may look like this (two lines, second line starts with a tabulation):
List-Id: "Mailing list for \"Foo Bar\""
<foo-bar.lists.example.net>
It should be possible to extract so-called "phrase" part of the header (Mailing list for "Foo bar").
Existing function addrparse_header does not work because it returns MailListAddr. An attempt to extract an address with extract_singe_info fails to parse the field with an error "Invalid address found: must contain a '@' symbol".
So the field cannot be parsed as an address list and a dedicated parser for List-Id is needed.
Hi, sorry for the delay here. I don't think I'll have time in the foreseeable future to implement this but I would take a PR. Can probably reuse most of the code from the existing header parser but have separate types for holding the parsed results and returning them.
@link2xt mail-parser implements RFC 2919 (among others).