[Email-SIG] Some parsing/generation issues of email in Python 3
R. David Murray
rdmurray at bitdance.com
Thu Jun 9 16:00:18 EDT 2016
On Thu, 09 Jun 2016 18:37:54 +0200, Hans-Peter Jansen <hpj at urpla.net> wrote:
> Apart from all considerations related to streaming/memory
> consumption/assembly, IMHO the weakest spot of the email package is header
> handling: the magic formula
>
> str(email.header.make_header(email.header.decode_header(msg['subject'])))
>
> for getting to the "real" subject string is, cough, improvable.
>
> Sure, this is complicated by the all the other modules, that are using
> email.header as well. I can only remotely imagine, how hard this is going to
> be in order to get this out of the SNAFU state..
That's exactly what the new policies like SMTP do, using all the new
code I wrote. (That is, I did the hard work a couple years ago.)
With the new policies, getting the "real" value of the header becomes:
msg['subject']
Now we just have to work out the bugs in the new code :)
Streaming and memory consumption have yet to be addressed. By the time
that's done, there won't be much of the original code left outside of
the compatibility mode :)
--David
More information about the Email-SIG
mailing list