Skip to content

Support chunk sending in smtplib #135952

Open
@jsbucy

Description

@jsbucy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usagestdlibPython modules in the Lib dirtopic-emailtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions