I have a table of clients, their emails, and a representative that they are assigned to:
Client | Rep | |
---|---|---|
1234 | bob@bobsco.com | John |
5678 | jim@jimsco.com | Jane |
The emails I receive from these clients go into an inbox that has subfolders with each rep's name.
I receive hundreds of these emails, and would like to sort them automatically.
How would I write a loop that would assign these emails to the correct rep's folder based on the email address that sent it? Alternatively, the email that gets sent out will always have the client number in the body, I could loop over that as well.
import win32com.client as client
# create outlook instance
outlook = client.Dispatch('Outlook.Application')
# get the namespace object
namespace = outlook.GetNameSpace("MAPI")
inbox = namespace.GetDefaultFolder(6)