Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error while sending email via outlook
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi All,

I am writing a script like below to send email via outlook. I am getting a general run error on line 10 (ObjMailItem.send).

Code:
1. Dim objOutl
2. Set WshShell = CreateObject("WScript.Shell")
3. Set objOutl = CreateObject("Outlook.Application")
4. Set objMailItem = objOutl.CreateItem(olMailItem)
5. objMailItem.Display
6. strEmailAddr  = "abc@gmail.com"
7. objMailItem.to = strEmailAddr
8. objMailItem.Body = "Hi"
9objMailItem.Attachments.Add"D:\Result\Result.csv"
10. objMailItem.send
11. Set objMailItem = nothing
12. Set objOutl = nothing

Can anybody tell me where am I going wrong? I am using Microsoft Outlook version 2003, with Service Pack3 and QTP Version 9.5.

Thanks in advance.

Regards,
Reema.
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi All,

I am not sure if anybody has an answer to this.... But I think it is Microsoft Outlook version issue. I found the error code (-2147467260) and googled it but could not find anything helpful.

I tried running it with Microsoft Outlook 2007, it works fine with Microsoft Outlook 2007. I am not sure why this is happening. But currently I think this is the compatibility issue with QTP9.5 and Microsoft Outlook 2003 SP3. There is a communication error with the software object.

If anybody finds any further details on this, please let me know it would be very helpful.

Thanks in advance.

Regards,
Reema.
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi reema,


Your script is working fine in my system.I think the problem is with your software versions.

Regards
Srikanth K
Reply


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
  Sending json file request and validating response in soap UI tool using Groovy script smiley 0 3,880 07-19-2017, 04:58 PM
Last Post: smiley
  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,067 06-15-2014, 09:03 AM
Last Post: nidhitaneja
  Clicking a link in an outlook email using QTP kirti 0 5,613 06-15-2014, 01:25 AM
Last Post: kirti

Forum Jump:


Users browsing this thread: 1 Guest(s)