Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Email from qtp to Microsoft outlook through vb script
#21
Solved: 11 Years, 4 Months ago
Use this vbscript. For sending email.

Create a text file and save one or more email addresses in that file. eg.
"c:\email.txt" will have the following entries
abc@abc.com
def@abc.com
etc@etc.com


Create a vbs file, this will be responsible for sending emails. Say this is email.vbs

Code:
strofile = "c:\email.txt"
'Open the file for reading
Set fso = CreateObject("Scripting.FileSytemObject")
'Get the email addresses
Set ObjInpFile = fso.OpenTextFile(strofile,1)
inpdata = Split(objInpfile,ReadAll,vbnewline)
Dim ObjEmail
    For each strdata in inpdata
        set objEmail = CreateObject("CDO.Message")
        ObjEmail.from = "someone@somewhere.com"
        ObjEmail.to = strdata
        ObjEmail.Subject = "Some subject"
        ObjEmail.Textbody = "Text Body"
'SMTP Server Config
        ObjEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        ObjEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your smtp server name"
        ObjEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        ObjEmail.Send
     Next
ObjInpFile.close
Set ObjEmail = Nothing
Reply


Messages In This Thread
RE: Email from qtp to Microsoft outlook through vb script - by gammaflare - 08-06-2008, 11:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Send automatic email notification when test run started helmzshelmz 0 1,068 04-03-2020, 07:54 AM
Last Post: helmzshelmz
  How to attach HTML file to Email Naresh 0 3,062 04-06-2015, 02:04 PM
Last Post: Naresh
  Help getting Sender Name from Email nidhitaneja 0 2,069 06-15-2014, 09:03 AM
Last Post: nidhitaneja
  Clicking a link in an outlook email using QTP kirti 0 5,616 06-15-2014, 01:25 AM
Last Post: kirti
  How do I save name and email address in QTP ? Shiv Y 1 2,491 12-19-2013, 07:24 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)