When we want to share information, sometimes the fastest way to do so is to just send an e-mail. In this recipe, we'll cover how we can generate a static chart and then e-mail it to someone programmatically.
Install PhantomJS following the instructions found on the PhantomJS website at http://phantomjs.org.
Install Python 2.7 following the instructions found on the Python website at http://www.python.org/getit/.
To get started, perform the following steps:
Create a new Python file
email_static.py
.Import the different Python modules we'll be using as shown in the following code:
import smtplib, os from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email.Utils import COMMASPACE, formatdate...