Monday, February 7, 2011

Vbscript code to send a mail in QTP


Function SendMail()

       Set objMessage = CreateObject("CDO.Message")
       objMessage.Subject = "This is for Subject text" ' Subject details
       objMessage.From = "abc@gmail.com" ' From Email ids
       objMessage.To = "abc@gmail.com;All@gmail.com" ' To Email ids
       objMessage.CC = "abc@gmail.com;All@gmail.com" ' CC Email ids
       objMessage.BCC = "abc@gmail.com;All@gmail.com" ' BCC Email ids
       'objMessage.TextBody ="Place Normal text body" ' For Text format
       objMessage.HTMLBody = "Place HTML code for body text"  For HTML body
       objMessage.AddAttachment "C:\abc.txt" ' Path for Attachment
       objMessage.Send
 
End Function

No comments: