How to read mail from outlook in QTP
Code below can be used to read an email from mailbox folder of microsoft outlook.Set appOutl = Wscript.CreateObject("Outlook.Application")
Set objSession = appOutl.GetNameSpace("MAPI")
' 6 = "Inbox"
' 9 = "Calendar"
' 10 = "Contacts"
Set MyFolder = objSession.GetDefaultFolder(6)
Msgbox MyFolder.name & ", " & MyFolder.Items.Count
Set myItems = myFolder.Items
For I = 1 to MyFolder.Items.Count
MsgBox MyItems(I).subject & " : " & MyItems(I).body
' display subject and body of all email from inbox.
Next
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs