sending email through qtp - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: sending email through qtp (/Thread-sending-email-through-qtp) |
sending email through qtp - vijay44 - 01-20-2010 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") 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 RE: sending email through qtp - Saket - 01-20-2010 use 'CreateObject' instead of 'GetObject', also to check whether it is open or not, you will have to check in the processes (you can use WMI scripting). RE: sending email through qtp - vijay44 - 01-20-2010 Hi, Thanks for a quick response. I also have other problem, some thing to do with the path of the file to be attached. mailitm.attachments.add ("C:\\Documents and Settings\\Administrator\\Desktop\\Test3\\Res1\\Report.xml") . As the path of the result file varies with the testname, i dont want to hardcord it. Is there any way that i cannot hard code it. Any reply would be really appreciated. Regards; Vijay RE: sending email through qtp - sreekanth chilam - 01-20-2010 Hi, You can use Built-In Environment variables in the below way. Code: mailitm.attachments.add (Environment("ResultDir")&"Report.xml") RE: sending email through qtp - vijay44 - 01-20-2010 Hi, Thanks a lot for the quick response. Regards; Vijay |