Sending HTML Email From Python

(Due to changes in the Python standard library, I’ve posted a new updated method to send HTML email from Python.)

I forget where exactly I found this, but the other day I needed a quick Python method to send an HTML email — in my case, it was in response to a Web CGI request, but this example below is usable anywhere. The bits that need to be changed for different situations should be evident (‘somefile.txt’ for example). You will also need to point the smtplib to an actual mail server if you don’t run one on the local machine.

Continue reading “Sending HTML Email From Python”