Skip to content

Instantly share code, notes, and snippets.

@David-Guillot
David-Guillot / send_html_email.py
Last active September 24, 2019 07:54
Python script to send HTML email from command line
# Simple script used to send an HTML file as an HTML formatted email,
# using any SMTP service. Used for testing HTML emails.
# The core message-sending code is taken from the docs:
# http://docs.python.org/2/library/email-examples.html
# The code for correctly authenticating against Gmail comes from:
# http://kutuma.blogspot.co.uk/2007/08/sending-emails-via-gmail-with-python.html
import smtplib
import argparse
from getpass import getpass
from email.mime.multipart import MIMEMultipart