Is email.message.get() case insensitive for the header name?

MRAB python at mrabarnett.plus.com
Sun Feb 14 16:36:02 EST 2021


On 2021-02-14 20:50, Chris Green wrote:
> It isn't clear from the documentation. Does email.message.get() care
> about the case of the header it's getting?
> 
> I checking mailing list mails and the "List-Id:" header is a bit
> 'mixed', i.e. it can be List-Id:, or List-ID: or list-id:, will
> email.message.get("List-Id:", "unknown") find all of them?
> 
According to the specification that it follows, the field names are not 
case-sensitive.

Incidentally, the colon is a separator and not part of the field name.


More information about the Python-list mailing list