Staging
v0.5.1
https://github.com/python/cpython
Revision 826a8b708165796151ad4135b0ddbd79da6d39f1 authored by Victor Stinner on 15 February 2019, 11:34:17 UTC, committed by GitHub on 15 February 2019, 11:34:17 UTC
Add credit for the cert parser vulnerability. Mention also Cisco
TALOS-2018-0758 identifier.
1 parent 2f1a317
Raw File
Tip revision: 826a8b708165796151ad4135b0ddbd79da6d39f1 authored by Victor Stinner on 15 February 2019, 11:34:17 UTC
bpo-35746: Credit Colin Read and Nicolas Edet (GH-11866)
Tip revision: 826a8b7
email-mime.py
# Import smtplib for the actual sending function
import smtplib

# Here are the email package modules we'll need
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart

COMMASPACE = ', '

# Create the container (outer) email message.
msg = MIMEMultipart()
msg['Subject'] = 'Our family reunion'
# me == the sender's email address
# family = the list of all recipients' email addresses
msg['From'] = me
msg['To'] = COMMASPACE.join(family)
msg.preamble = 'Our family reunion'

# Assume we know that the image files are all in PNG format
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()
    msg.attach(img)

# Send the email via our own SMTP server.
s = smtplib.SMTP('localhost')
s.sendmail(me, family, msg.as_string())
s.quit()
back to top