summaryrefslogtreecommitdiff
path: root/Doc/includes/email-simple.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2016-09-07 21:15:59 -0400
committerR David Murray <rdmurray@bitdance.com>2016-09-07 21:15:59 -0400
commit29d1bc0842e5b086813aa7de4ab18f1c192d2291 (patch)
treeb812609f72f860adb5203ba9cbb1d0c4299e39af /Doc/includes/email-simple.py
parent23e863378124229928e12b72c22df33f1428c61e (diff)
downloadcpython-git-29d1bc0842e5b086813aa7de4ab18f1c192d2291.tar.gz
#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.
Diffstat (limited to 'Doc/includes/email-simple.py')
-rw-r--r--Doc/includes/email-simple.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/includes/email-simple.py b/Doc/includes/email-simple.py
index b9b8b410a6..f69ef40ff0 100644
--- a/Doc/includes/email-simple.py
+++ b/Doc/includes/email-simple.py
@@ -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