Skip to main content

Posts

Showing posts from May, 2023

Read the Office 365 Outlook specific email in python

 Below is the program which shows how to read the Office 365 Outlook Inbox emails received from specific email-id in python. I have read all the email id from which I have got emails in the inbox folder. Also, I have all the emails text body from received from specific email-id in python. For this you need to install the pywin32 library in your program using following command. pip install pywin32 The program is: from win32com.client import Dispatch import win32com outlook = Dispatch( "Outlook.Application" ).GetNamespace( "MAPI" ) inbox = outlook.GetDefaultFolder( "6" ) all_inbox = inbox.Items folders = inbox.Folders for msg in all_inbox: if msg.Class == 43 : if msg.SenderEmailType == 'EX' : print (msg.Sender.GetExchangeUser().PrimarySmtpAddress) else : print (msg.SenderEmailAddress) outlook = win32com.client.Dispatch( "Outlook.Application" ).GetNamespace( "MAPI" ) inbox = outlook.GetDe...

Read the Office 365 Outlook Inbox emails in python

 Below is the program which shows how to read the Office 365 Outlook Inbox emails in python. I have read all the email id from which I have got emails in the inbox folder. Also, I have read the last/latest email body in python. For this you need to install the pywin32 library in your program using following command. pip install pywin32 The program is: from win32com.client import Dispatch import win32com outlook = Dispatch( "Outlook.Application" ).GetNamespace( "MAPI" ) inbox = outlook.GetDefaultFolder( "6" ) all_inbox = inbox.Items folders = inbox.Folders for msg in all_inbox: if msg.Class == 43 : if msg.SenderEmailType == 'EX' : print (msg.Sender.GetExchangeUser().PrimarySmtpAddress) else : print (msg.SenderEmailAddress) outlook = win32com.client.Dispatch( "Outlook.Application" ).GetNamespace( "MAPI" ) inbox = outlook.GetDefaultFolder( 6 ) messages = inbox.Items message = messages.Get...