Forum Discussion
sarya
14 years agoFrequent Contributor
Hi Jared,
I am trying to automate the scenario whether I received a particular mail or not but it seems if that particular mail is not there I won't be able to automate that scenario if the mailbox is empty but what if the mailbox has some mails. I modified my script below. Where can I add that particular checkpoint when it does not find that particular message when mailbox has some items. Do I need to use if-elseif -else statements ?
VerifyBodySubject(sub,body1,body2){
I am trying to automate the scenario whether I received a particular mail or not but it seems if that particular mail is not there I won't be able to automate that scenario if the mailbox is empty but what if the mailbox has some mails. I modified my script below. Where can I add that particular checkpoint when it does not find that particular message when mailbox has some items. Do I need to use if-elseif -else statements ?
function VerifyBodySubject(sub,body1,body2)
{
VerifyBodySubject(sub,body1,body2){
//'#### Set ALL INTERNAL VARIABLES
var msOutlook;
var mapi;
var inbox;
var i ;
var msOutlook = Sys.OleObject("Outlook.Application");
var mapi = msOutlook.GetNamespace("MAPI");
var inbox = mapi.Folders("Mailbox - Sumedha Arya").Folders("Inbox").Folders("Test");
Log.Message(inbox.Items.Count);
for( i = 1; i <= inbox.Items.Count; i++)
{
toolEmail = inbox.Items.Item(i);
sub1 = toolEmail.Body;
sub2 = toolEmail.Subject;
if (sub1.indexOf(body1)!= -1 && sub1.indexOf(body2)!= -1 && sub2.indexOf(sub)!=-1)
{
Log.Message(toolEmail.Body + "And " + toolEmail.Subject);
Log.Message("The body and subject of the mail are verified","",pmNormal,Attr);
toolEmail.Delete();
break;
}
else
{
continue;
}
break;
}
Thanks,
Sumedha
Related Content
- 6 years ago
- 3 years ago
- 4 years ago
- 4 years ago
Recent Discussions
- 17 hours ago
- 17 hours ago
- 4 days ago