This object can contain several sub-classes, each corresponding to a different media type.
The email will be contained within something called a MIMEMultipart object. We use email to build the email messages themselves, and smtplib to send the message. Implemented correctly, we will save a significant amount of time, and eliminate the potential of human error.įor this task, we will be utilizing two libraries, email and smtplib.
#PYTHON CREATE OUTLOOK EMAIL WITH ATTACHMENT HOW TO#
We will learn how to use Python to dynamically write emails, include relevant images, and attach important files. This type of repetition is ripe for automation. Many of us have countless emails that require us to run through a repetitive process, sending a repetitive summary of said process, and to the same people week after week. What we have there is an unimaginable amount of human potentially being thrown into the void of useless e-mail tasks.Īlthough Python may not be able to fix all of these problems, it certainly can help. They found that we waste, on average, one hour and 21 minutes - every single day due to e-mail. Without it, the world would look very different.īut, is all of this time spent on email really that necessary? A study from Harvard Business Review believes that no, it is not. For the average American, that amounts to 2 hours and 36 minutes a day.Į-mail is the oil that keeps the cogs of the working world turning. The typical worker spends a total of 28% of their time reading and answering e-mail. If you are reading this article on a weekday, you likely have either already sent a few emails, or will do very soon.