python - How to send email attachments? - Stack Overflow
stackoverflow.com › questions › 3362600Jul 29, 2010 · import os.path import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.application import MIMEApplication def send_email(subject, message, from_email, to_email=[], attachment=[]): """ :param subject: email subject :param message: Body content of the email (string), can be HTML/CSS or plain text :param from_email: Email address from where the email is sent :param to_email: List of email recipients, example: ["a@a.com", "b@b.com ...