This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: smtplib Sends Commands in Lower-Case
Type: enhancement Stage:
Components: email Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barry, luiji, r.david.murray
Priority: low Keywords:

Created on 2014-04-18 11:03 by luiji, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg216779 - (view) Author: Luiji Maryo (luiji) Date: 2014-04-18 11:03
It has occurred to me while testing an SMTP server with smtplib that it sends commands in lower-case. This is problematic because, although most SMTP servers seem to be case-insensitive, RFC 5321 (SMTP) doesn't seem to explicitly require this and there may be systems out there which require upper-case commands. Additionally, the output just looks unclean because the parameters are given capitalized (e.g. we get "mail FROM:<guy@example.com>" instead of "MAIL FROM:<guy@example.com>" or "mail from:<guy@example.com>".

I would propose that putcmd() use cmd.upper(). Alternatively, all instances of putcmd() and docmd() could be updated to have the commands in capitalized form so that, should the user desire, they could send lower-case commands, though I don't quite see what would be useful about that.
msg216895 - (view) Author: Luiji Maryo (luiji) Date: 2014-04-20 03:10
Apologies, I was tired when I looked into this. It turns out that SMTP is explicitly case-insensitive with command names. I still think it'd be nice to use upper-case commands for consistency with the FROM: and TO: lines, though, or to put the FROM: and TO: lines in lower-case.
History
Date User Action Args
2022-04-11 14:58:02adminsetgithub: 65495
2014-04-20 15:15:28pitrousetpriority: normal -> low
type: behavior -> enhancement
versions: - Python 3.2, Python 3.3, Python 3.4
2014-04-20 04:03:52r.david.murraysetnosy: + barry, r.david.murray
components: + email
2014-04-20 03:10:20luijisetmessages: + msg216895
2014-04-18 11:03:16luijicreate