rfc5322

Are email headers case sensitive?

旧时模样 提交于 2019-11-27 13:41:33
问题 Are email headers case sensitive? For example, is Content-Type different from Content-type ? According to RFC 5322, I don't see anything about case sensitivity. However, I'm seeing a problem with creating MIME messages using the PEAR Mail_mime module, and everything is pointing to the fact that our SMTP server uses Content-type and MIME-version instead of Content-Type and MIME-Version . I tried using another SMTP server (like GMail), but unfortunately our web servers are firewalled pretty

Parsing date with timezone from an email?

左心房为你撑大大i 提交于 2019-11-26 01:01:44
问题 I am trying to retrieve date from an email. At first it\'s easy: message = email.parser.Parser().parse(file) date = message[\'Date\'] print date and I receive: \'Mon, 16 Nov 2009 13:32:02 +0100\' But I need a nice datetime object, so I use: datetime.strptime(\'Mon, 16 Nov 2009 13:32:02 +0100\', \'%a, %d %b %Y %H:%M:%S %Z\') which raises ValueError, since %Z isn\'t format for +0100 . But I can\'t find proper format for timezone in the documentation, there is only this %Z for zone. Can someone

Parsing date with timezone from an email?

十年热恋 提交于 2019-11-25 22:38:58
I am trying to retrieve date from an email. At first it's easy: message = email.parser.Parser().parse(file) date = message['Date'] print date and I receive: 'Mon, 16 Nov 2009 13:32:02 +0100' But I need a nice datetime object, so I use: datetime.strptime('Mon, 16 Nov 2009 13:32:02 +0100', '%a, %d %b %Y %H:%M:%S %Z') which raises ValueError, since %Z isn't format for +0100 . But I can't find proper format for timezone in the documentation, there is only this %Z for zone. Can someone help me on that? Ben James email.utils has a parsedate() function for the RFC 2822 format, which as far as I know