import smtplib for the actual sending function here are the email package modules we ll need create the container email message me the sender s email address family the list of all recipients email addresses open the files in binary mode you can also omit the subtype if you want mimeimage to guess it send the email via our own smtp server import smtplib for the actual sending function here are the email package modules we ll need create the container email message me the sender s email address family the list of all recipients email addresses open the files in binary mode you can also omit the subtype if you want mimeimage to guess it send the email via our own smtp server
import smtplib


from email.message import EmailMessage


msg = EmailMessage()
msg['Subject'] = 'Our family reunion'


msg['From'] = me
msg['To'] = ', '.join(family)
msg.preamble = 'You will not see this in a MIME-aware mail reader.\n'



for file in pngfiles:
    with open(file, 'rb') as fp:
        img_data = fp.read()
    msg.add_attachment(img_data, maintype='image',
                                 subtype='png')


with smtplib.SMTP('localhost') as s:
    s.send_message(msg)