Using Microsoft Outlook to Send Email

The code below illustrates two methods for sending email using the VBScript code in QuickTest Professional, and two different COM objects.

' Example 1

Function SendMail(SendTo, Subject, Body, Attachment)

       Set ol=CreateObject("Outlook.Application")

       Set Mail=ol.CreateItem(0)

       Mail.to=SendTo

       Mail.Subject=Subject

       Mail.Body=Body

       If (Attachment <> "") Then

              Mail.Attachments.Add(Attachment)

       End If

       Mail.Send

       ol.Quit

       Set Mail = Nothing

       Set ol = Nothing

End Function

' Example 2

Function SendMail(SendFrom, SendTo, Subject, Body)

       Set objMail=CreateObject("CDONTS.Newmail")

       ObjMail.From = SendFrom

       ObjMail.To = SendTo

       ObjMail.Subject = Subject

       ObjMail.Body = Body

       ObjMail.Send

       Set objMail = Nothing

End Function

 

4 comments:

Alexis said...

When I read important mail,it has corrupted,and I used next application-outlook 2003 pst viewer,tool has free status as far as I know,utility will help you to solve mail recovery problems,program was developed as a good addition for Microsoft Outlook, our customers usually recover their mailboxes, stored on Microsoft Outlook,easily guide you through all steps of recovery process, it does not matter, which level of computer skills do you have, Outlook 2003 .pst file viewer is easy for everyone, from beginners to professionals. We believe, that documentation is not needed.

Alex said...

Once I was in global network and found one tool for recover mails,I could find anything,but accidentally I saw this tool-recover contacts from pst,it has many capacities and is free as far as I remember,tool helped me not once,moreover utility recover contacts and recover contacts pst exists,can help in such cases and restore contacts from your mail account,tool can work with all supported versions of Microsoft Exchange Server and Microsoft Outlook email client for restore contacts .pst file,extract contacts as *.vcf files, that can be further imported to any Personal Information Management (PIM) tool or Windows Address Book,utility can be extracted as a list of files in *.eml, *.txt and *.vcf formats, the files will be placed to any folder upon your choice,convert *.ost file into a *.pst file, that can be easily opened by any email client, compatible with Microsoft Outlook.

Alexis said...

Some days ago I had difficult situation.All of my mails were corrupted no one know how and I tried next tool-pst reader or viewer.It advised to me a friend and I was surprised application solved my problems in seconds and without payment.I gave a present for my friend for this help.

Bharath Marrivada said...

Send email with out installing MS Outlook.
Attaching the link.

http://bharath-marrivada.blogspot.com/2010/02/how-to-send-email-with-attachments.html