Forum Discussion

Seetal's avatar
Seetal
Occasional Contributor
13 years ago

Verifying details in an email message body

Hi..



I would like to find out more information of how I can verify the message body details of an Outlook email.



When I spy on a email on the mesaage text the whole panel is returned where the property 'Name' has a value of 'Panel("Message") however I cannot find how to get the text that is within the email message.



Is this possible with TestComplete V 9.0?



If yes, where can I get more information to help me do this?



Thanks

  • Here's an experiment I did a while back to get the body text of all "Your account" emails in my inbox. It should give you some clues.




    function TESToInbox(){


        var Oapp = Sys.OleObject("outlook.application", "")


        var MAPI = Oapp.GetNamespace("MAPI");


        //MAPI.Folders.Items(n)


            //1 = Mailbox


                //.Folders.Items(


            //2 = Public Folders


        var Mailbox = MAPI.Folders.Item(1).Folders;


        var boxCount = Mailbox.Count;


        for (var i = 1; i <= boxCount; i++) {


            Log.Message(i + " " + Mailbox.Item(i).Name);


        }


        var oInbox = MAPI.getDefaultFolder(6);


        var latestItem = oInbox.Items.Count; 


        while (latestItem) {


            if (~oInbox.Items(latestItem).Subject.indexOf("Your account")) {


                Log.Message(oInbox.Items(latestItem).Body);


            }


            latestItem--;


        }


    }

  • Seetal's avatar
    Seetal
    Occasional Contributor
    Do any TestComplete experts have an answer for my question?

  • Hi Seetal,


     


    Nick's example shows how to get access to Outlook via COM. Actually, this way is more reliable, and it gives you more features in comparison with Outlook's GUI testing.

  • Hi ,



    How to read inbox mails using CDO object with specified SMTP Server Adress.





    Thanks in Advance



    -Srikanth