mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
#24277: The new email API is no longer provisional.
This is a wholesale reorganization and editing of the email documentation to make the new API the standard one, and the old API the 'legacy' one. The default is still the compat32 policy, for backward compatibility. We will change that eventually.
This commit is contained in:
parent
23e8633781
commit
29d1bc0842
25 changed files with 2078 additions and 1670 deletions
|
|
@ -2,13 +2,13 @@
|
|||
import smtplib
|
||||
|
||||
# Import the email modules we'll need
|
||||
from email.mime.text import MIMEText
|
||||
from email.message import EmailMessage
|
||||
|
||||
# Open a plain text file for reading. For this example, assume that
|
||||
# the text file contains only ASCII characters.
|
||||
# Open the plain text file whose name is in textfile for reading.
|
||||
with open(textfile) as fp:
|
||||
# Create a text/plain message
|
||||
msg = MIMEText(fp.read())
|
||||
msg = EmailMessage()
|
||||
msg.set_content(fp.read())
|
||||
|
||||
# me == the sender's email address
|
||||
# you == the recipient's email address
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue