Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Last active September 3, 2022 14:23
Show Gist options
  • Select an option

  • Save samirsaci/e079a737e03ac2d3d4f29dce647766d4 to your computer and use it in GitHub Desktop.

Select an option

Save samirsaci/e079a737e03ac2d3d4f29dce647766d4 to your computer and use it in GitHub Desktop.
# Message Object
msg = MIMEMultipart()
msg['Subject'] = 'Workload Report for {}'.format(WEEK)
msg['From'] = from_mail
msg['To'] = ', '.join([from_mail, to_mail])
msg.preamble = 'Workload Report for {}'.format(WEEK)
# Attach the HTML code
msg.attach(MIMEText(html_string, 'html', 'utf-8'))
# Send the email via our own SMTP server
server = smtplib.SMTP_SSL(smtp_server, smtp_port)
server.ehlo()
server.login(from_mail, from_password)
server.sendmail(from_mail, [from_mail, to_mail], msg.as_string())
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment