My application will send an email upon new user registration, that email contains new user registration info. How can I read the email subject, timestamp and email context? Thanks advance.
My inbox structure is someting like this,
Inbox >> Users.
Usually email related testing using automation might not be in scope , if your project demands it then you may use in-built functions in QTP like 'GetRoProperty()' and get the text from the subject line text box and get the time stamp from the relevant location. However you need to record the standard navigation path in your case being "Inbox >> Users."
Below code will make a connection to current outlook account in your system.. Get the count and run through the Loop to get the details.
Not sure how to make connection to a other outlook accounts and other personal mail id. I tried this when i was not much busy with my work and it's not used in my project. Use this as a start and find out your solution.
Set oApp = CreateObject("Outlook.Application")
Set oNamespace = oApp.GetNamespace("MAPI")
set oFolders = oNamespace.Folders(strMailbox)
set Inbox = oFolders.Folders(strMailFolder)
set oFolder = Inbox.Items
'Get the first email item - use index to select or loop through all of them
Set oMsg = oFolder.GetLast
Do While True
If Trim(oMsg.Subject) = Trim(strMsg_subject) Then
'msgbox oMsg.Subject & " was last received: " & oMsg.receivedTime
getMailLastReceivedTime = oMsg.receivedTime
Set oMsg = oFolder.GetPrevious
End Function</pre><hr />