![]() Anyway, I come around to do both your checking for unread email in the class Handler_Class and restart the monitoring in case you restart Outlook. I guess the fact of closing Outlook "unlink" with pythoncom.PumpMessages(). Put this code before your definition of outlook in your codeįor me, the code you posted works great until I close Outlook and then even if I reopen it, I don't get anything when a new message is received (see one of my comments). Print message.Subject #or whatever command you want to do Inbox = ol.GetNamespace("MAPI").GetDefaultFolder(6) So if you restart your python script every time your Outlook restart, then add these lines to your code to check unread emails in your Inbox: ol = ( "Outlook.Application") Or let me know for any alternate procedure Is there any function to check for unread mails to add within handler_class ![]() #and then an infinit loop that waits from events.Įven i want to go through all the unread mails to check whether a mail from a sender has came and process it( if found) Outlook = ("Outlook.Application",Handler_Class) Print command # Or whatever code you wish to execute. # You know, sometimes more than 1 mail is received at the same moment.Ĭommand = re.search(r"%(.*?)%", subject).group(1) # RecrivedItemIDs is a collection of mail IDs separated by a ",". ![]() However, there may be some situation where my outlook was restarted, mean while i received mail from sender and marked as unreadįor continuous monitor for a new mail for a specific subject i have found the following code import win32com.client I want to check for a particular sender email and process it automatically wherever it arrives ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |