python / python/cpython

Support chunk sending in `smtplib`

未关闭
#135,952 6 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

performance stdlib topic-email type-feature
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Feature or enhancement

Proposal:

smtplib.SMTP currently has the method data(msg : Union[bytes, str]) to send the message which takes the entire serialized rfc822 message as bytes or str. Email messages can be pretty large -- 10M or more. So it would be nice to be able to send the message in chunks without having to bring it all into the python heap at once. I have a proof-of-concept of this
that adds a parameter data(msg : bytes, last : bool) that I am using in Koukan my mta project.

smtp.data(b'hello\r\n', last=False)
smtp.data(b'world!\r\n', last=True)

I wanted to see if there was any interest in merging this. Building on this, I have another patch to add support for rfc3030 CHUNKING/BDAT which is maybe a separate discussion but if we extend the api here, it ought to be able to support both dotstuff and bdat transparently.

In parallel with this, I am trying to make the corresponding change to aiosmtpd

Has this already been discussed elsewhere?

https://discuss.python.org/t/smtplib-chunked-sending/96804

Links to previous discussion of this feature:

No response

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 smtplib.SMTP.data 开始,查看链接的 chunked data 概念验证,然后阅读链接的 Python 讨论。在实现之前,解决 API 及其与 RFC 3030 CHUNKING/BDAT 和 dot-stuffing 的关系;当一个达成共识的 chunk 发送设计被接受时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
networking
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。