Skip to content

hornlaszlomark/python_outlook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 

Repository files navigation

Microsoft Outlook manipulation with win32com (Python)

This will always be the first thing to do when interacting with your Outlook on your computer:

import win32com.client
outlook = win32.client.Dispatch("Outlook.Application").GetNamespace("MAPI")

You can decide which path to take to continue. 1.) The standard path where you choose the default folder.

root_folder = outlook.GetDefaultFolder(6)

OR the custom path where you decide and deliberately choose which email address to use. 2.)

root_folder = outlook.Folders(1).Items
messages = root_folder.Folders.Item(1) # this should be the incoming messages folder

You can also you the exact name of the folder. For example: 3.)

root_folder = outlook.Folders('Inbox').Items

Let's take number 2.) because it gives us more control over our script/program.

#TODO:

Looping through folders:

for folder in root_folder.Folders:
  print(folder.Name)

FIND MORE DETAILED INFO IN THE WIKI: https://github.com/hornlaszlomark/python_outlook/wiki

... to be continued ... #TODO:

  • accessing parts of messages (Sender.Name, SenderEmailAddress, Body, etc.)
  • loop through messages
  • loop thorugh messages based on certain conditions
  • loop through messages and download attachments
  • loop through messsages and download certain attachments
  • writing and sending email

All of the above is coming soon!

About

Microsoft Outlook manipulation with Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published