Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sending email through qtp
#1
Solved: 10 Years, 9 Months, 3 Weeks ago
Hi,
I have tried the below piece of code, i was able to send email through qtp, but i didn't wanted to invoke outlook each time, i run, so i added piece of code intially which checks whether the outlook is open.

Code:
Set mailob = GetObject(", outlook.application")
If Not Obj Is Nothing Then
Msgbox "Outlook is already open"
Else
systemUtil.Run "OUTLOOK.EXE"
End If
Set Obj = Nothing
'systemUtil.Run "OUTLOOK.EXE" ' Comment this line, if outlook is already open
Set Wshshell = CreateObject("Wscript.Shell")
set mailob = createobject("outlook.application")
wait(5)
set mailitm = mailob.createitem(0)
wait(5)
mailitm.display 'this being an optional step
wait(5)
mailitm.to = "dtulasi@abc.com"
mailitm.cc = "dtulasi@xyz.com;dtulas@zyx.com"
wait(5)
mailitm.subject = "QTP Result"
wait(5)
mailitm.attachments.add ("C:\Documents and Settings\Administrator\Desktop\Test3\Res1\Report.xml") 'path of file
mailitm.send
I am facing 2 propblems over here

At line 1 iam getting general error

and also i am manually specifying the attachment path, that too isn't working, is there any way that i can change this hard coded path

Any help would be really appreciated.

Regards;
Vijay
Reply


Messages In This Thread
sending email through qtp - by vijay44 - 01-20-2010, 10:12 AM
RE: sending email through qtp - by Saket - 01-20-2010, 10:39 AM
RE: sending email through qtp - by vijay44 - 01-20-2010, 12:59 PM
RE: sending email through qtp - by vijay44 - 01-20-2010, 02:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extracting Email Body from Outlook waseem.khan.91 0 1,954 03-04-2019, 02:53 PM
Last Post: waseem.khan.91
  Extracting Email Body from Outlook waseem.khan.91 0 1,059 03-01-2019, 02:51 PM
Last Post: waseem.khan.91
  Find the email using subject with the help of vb script Raheem Shaik 0 1,479 12-12-2018, 02:57 PM
Last Post: Raheem Shaik
Rolleyes Urgent help with Gmail Sending mail feature nidhitaneja 2 2,771 03-05-2014, 09:39 PM
Last Post: nidhitaneja
  Cannot attach the text file to email arpan 2 3,299 07-19-2013, 12:13 AM
Last Post: arpan

Forum Jump:


Users browsing this thread: 1 Guest(s)