python script to read the emails from custom folder from Microsoft Outlook
mailbox which occurs repeatedly
I am completely new to Python and have been given the task to write a
program that connects to my Microsoft Outlook mailbox, goes through all
the emails and if the subject has a certain word,goes through the message
body.and thsese typa of msges are recevied for every second and two mails
may cme same time,have to go through all the mails.to make it easier we
have made new folder and set a rule that all these kind of mails are
received to custom folder. The script need to connect to outlook all the
time even if the sytem is log off.and read each and every mail and search
for a perticular value in the body. I had googled abt this and have the
code to read a last mail in inbox.i am nt able to get into the custom
folder.
can any one please share some knowledge about this.
Here is the code import win32com.client
outlook =
win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
messages = inbox.Items
message = messages.GetLast()
body_content = message.Body
print body_content
Thanks in advance.
Regards, Smitha. iGate Global Solution.
No comments:
Post a Comment