Hello all,

I believe that all of us would have come across mail delivery mechanism of an application at some point. Here in certain application actions trigger mails. I got a script from Google which talks about reading outlook contents using vb script -

<font class="small">Code:</font><hr /><pre>
'Get the Count of Items in Inbox
Set app = CreateObject("Outlook.Application")
Set nameSpace = app.GetNamespace("MAPI")
Set MyFolders = nameSpace.GetDefaultFolder(6)
MsgBox MyFolders.Items.Count

'Read unread items in Inbox
Set cols = MyFolders.Items

For each mail In cols
If mail.unread Then
MsgBox mail.subject
MsgBox mail.sendername
MsgBox mail.body
End If
</pre><hr />

My concern is, there are about 40 actions on my app which would trigger email generation and all of these mails would have different body hence I need to validate contents of all mails. Now timing is a big issue here, how do I sync execution of script so that first I get email in my Inbox before I start execution of scripts.