I was able to find the code to send email via QTP (outlook) by searching the QTP Knowledge Base. The code is below:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> Dim objOutlook
' Create the Outlook object and the new mail object.
Set objOutlook = CreateObject("Outlook.Application"
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
' Define a file for attachment
doc = "C:\temp\test.xls"
' Body of the message
objOutlookMsg.Subject = "my email"
objOutlookMsg.Body = "This is a test"
' Add the attachment to the email
' Display the email
' Send the message
' Release the objects
set objOutlook = nothing
set objOutlookMsg = nothing </pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">With the code above, An Outlook warning message will appear when the code is executed. Does anyone know of a way to get around the warning message?
I faced the same problem long time ago . I think the message is a warning message because you tried to connect to outlook through it's objects not through the API so it will show a security message.
my advice don't waste your time with outlook and try CDO "Collaborative Data Objects"
for more info. search this forum.