Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Absent Member.. vzamoraz Absent Member..
Absent Member..

QTP/UFT support tip: How to send and email by code using outlook object

You can create an Outlook object by code and use it to send emails.



Dim objOutlook 
Dim objOutlookMsg
Dim olMailItem
' Create the Outlook object and the new mail object.
Set objOutlook = CreateObject("Outlook.Application"
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
' Define mail recipients
objOutlookMsg.To = "sample@email.com" 
objOutlookMsg.CC = "sample@email.com" 
objOutlookMsg.BCC = "sample@email.com"

' Define a file for attachment
doc = "C:\temp\test.xls"
' Body of the message
objOutlookMsg.Subject = "Subject sample" 
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


HP support
If you find that this or any post resolves your issue, mark it as an accepted solution.



Note: The Opinions expressed in my post are mine alone, and do not reflect the opinions of my employer. No warranties express or implied for any answered posted.


Labels (1)
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.