Micro Focus QTP (UFT) Forums
Error while sending email via outlook - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Error while sending email via outlook (/Thread-Error-while-sending-email-via-outlook)



Error while sending email via outlook - reejais - 10-27-2010

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.


RE: Error while sending email via outlook - reejais - 10-28-2010

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.


RE: Error while sending email via outlook - ksrikanth2k9 - 02-09-2011

Hi reema,


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

Regards
Srikanth K