This commit is contained in:
2025-10-26 18:47:00 +01:00
parent e07296f23f
commit e635d7fda5
20 changed files with 1731 additions and 0 deletions

32
outlook.py Normal file
View File

@@ -0,0 +1,32 @@
import win32com.client
def process_outlook_emails_from_root():
# Connect to Outlook
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
# Get the root folder of the mailbox
root_folder = outlook.Folders.Item(1) # Typically the first item is the root
# Recursive function to process all folders
def process_folder(folder):
print(f"\nProcessing folder: {folder.Name}")
# # Iterate through all items in the current folder
# for item in folder.Items:
# if item.Class == 43: # 43 is the class for MailItem
# print(f"Found email - Subject: {item.Subject}")
# print(f" From: {item.SenderName}")
# print(f" Received: {item.ReceivedTime}")
# # Add your email processing logic here
# Recursively process subfolders
for subfolder in folder.Folders:
process_folder(subfolder)
# Start processing from the root folder
process_folder(root_folder)
if __name__ == "__main__":
process_outlook_emails_from_root()