summaryrefslogtreecommitdiff
path: root/Doc/includes/email-mime.py
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/includes/email-mime.py')
-rw-r--r--Doc/includes/email-mime.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Doc/includes/email-mime.py b/Doc/includes/email-mime.py
index a90edc1373..61d08302a2 100644
--- a/Doc/includes/email-mime.py
+++ b/Doc/includes/email-mime.py
@@ -20,9 +20,8 @@ msg.preamble = 'Our family reunion'
for file in pngfiles:
# Open the files in binary mode. Let the MIMEImage class automatically
# guess the specific image type.
- fp = open(file, 'rb')
- img = MIMEImage(fp.read())
- fp.close()
+ with open(file, 'rb') as fp:
+ img = MIMEImage(fp.read())
msg.attach(img)
# Send the email via our own SMTP server.