Skip to content

smtplib Sends Commands in Lower-Case #65495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
luiji mannequin opened this issue Apr 18, 2014 · 3 comments
Closed

smtplib Sends Commands in Lower-Case #65495

luiji mannequin opened this issue Apr 18, 2014 · 3 comments
Labels
easy topic-email type-feature A feature request or enhancement

Comments

@luiji
Copy link
Mannequin

luiji mannequin commented Apr 18, 2014

BPO 21296
Nosy @warsaw, @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2014-04-18.11:03:16.179>
labels = ['type-feature', 'expert-email']
title = 'smtplib Sends Commands in Lower-Case'
updated_at = <Date 2014-04-20.15:15:28.153>
user = 'https://bugs.python.org/luiji'

bugs.python.org fields:

activity = <Date 2014-04-20.15:15:28.153>
actor = 'pitrou'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['email']
creation = <Date 2014-04-18.11:03:16.179>
creator = 'luiji'
dependencies = []
files = []
hgrepos = []
issue_num = 21296
keywords = []
message_count = 2.0
messages = ['216779', '216895']
nosy_count = 3.0
nosy_names = ['barry', 'r.david.murray', 'luiji']
pr_nums = []
priority = 'low'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue21296'
versions = ['Python 3.5']

Linked PRs

@luiji
Copy link
Mannequin Author

luiji mannequin commented Apr 18, 2014

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.

@luiji luiji mannequin added the type-bug An unexpected behavior, bug, or error label Apr 18, 2014
@luiji
Copy link
Mannequin Author

luiji mannequin commented Apr 20, 2014

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.

@pitrou pitrou added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Apr 20, 2014
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
ambv pushed a commit that referenced this issue Jul 22, 2023
…107019)

Use lowercase `mail from` and `rcpt to` in `smtplib.SMTP`

SMTP commands are case-insensitive. `smtplib` uses lowercase commands,
however it writes `mail FROM` and `rcpt TO`, lacking consistency.
@ambv
Copy link
Contributor

ambv commented Jul 31, 2023

Fixed for 3.13. Thanks! ✨ 🍰 ✨

@ambv ambv closed this as completed Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy topic-email type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants