
Similar to working with Microsoft Outlook, it needs to be able to search on the subject, message sender or switch to a different subfolder of your inbox.Ī method to determine whether the email contains an attachment and when it does, it needs to download all attachments to my local computer. For this, I need to have the account name, its password and to know its host.Ī method to search for specific emails. These would form the main functions in the upcoming code.Ī method to connect to a specified email account. I identified that I would need three building blocks to enable me to download my attachments. IMAP handles all the messaging from and to the email servers and is used at most popular email services, such as Gmail, Outlook Office365 and Yahoo. These are email, to work with email messages (duh!), and imaplib, which is an SDK (software development kit) to use the Internet Messaging Protocol version 4 (IMAP4). As such, Python is ideal for automating your boring stuff (in reference to one practical Python handbook).Ī brief search on the internet indicated that two Python modules were of particular interest.

It is known to have many modules available, which are in turn high-level functions, definitions, and statements to achieve something specific, such as mathematical operations, machine learning, or connecting to email servers. To me, the most obvious approach would involve using Python, which is a high-level and general-purpose programming language.

I chose the automated approach, as it would be much quicker than the manual one, it would produce something that my client and I could reuse later, and, as it turns out, it was much more fun! One option would involve a lot of work by downloading these attachments manually with Outlook, while the other would require me to create some code to have the necessary downloading capabilities. Microsoft Outlook does not provide you with an elegant solution to download the attachments from multiple emails simultaneously, so I only had two options to get these attachments. These emails contained log reports and were sent to me every hour in preparation for the project. I recently had to download the attachments from a few thousand emails that were sent to me by an automated process at my current client.
