[issue28879] smtplib send_message should add Date header if it is missing, per RFC5322

R. David Murray report at bugs.python.org
Mon Dec 19 14:46:49 EST 2016


R. David Murray added the comment:

The documentation is all in the Doc subdirectory of the checkout.

So, this should teach me to rely on vague memory instead of reading the code.  I've probably still missed something because I don't have enough time to read it properly.

Yes, you are correct, the Resent headers need to be added by the user.  So adding a Resent-Date header is the only question, and we can assume that it should go before the first Resent-X header we find.

Here is my reconstruction of why I made that restriction and comment:  There is no specified order to the Resent- block headers.  So how do we know where the first block ends and the next begins?  It will almost always be at the Resent-Date header...but we can't assume that that will *always* be true.

For sendmail/send_message, I'm not going to look at a youtube video, so you'll have to make your argument in text :)  But you may not want to bother, it is indeed too late: we can't change the signature for backward compatibility reasons.  In any case IMO the signature is optimal as it is: the only required argument is msg, and that, therefore, has to come first.  Otherwise the arguments are already in the same order as they are for sendmail.

I spent a lot of time reading RFCs while working on these libraries, but it has been a while since my head was buried in that space :)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28879>
_______________________________________


More information about the Python-bugs-list mailing list