Send Email Sample using MSOutlook failed to initialize
- 10 years ago
Hi,
Try below code (VBScript) it is working.
Sub SendEmail
Set objOutlook = CreateObject("Outlook.Application")
Set objMailItem = objOutlook.CreateItem(0)
'Set the email properties
objMailItem.To = "ravik.ngk@email.com"
objMailItem.CC = "test@email.com"
'objMailItem.BCC = "" 'If BCC is not required, then this line can be omitted
objMailItem.Subject = " Test Execution Status using TestComplete"
objMailItem.Body= "PFA Test Execution Result" &chr(13)&chr(13)&"Thanks & Regards,"&chr(13)& Sys.UserName
FileName = Project.ConfigPath & "ExportedLog\TC Execution Status Or Result.mht"
'Call Log.SaveResultsAs(Filename, lsMHT)
objMailItem.Attachments.Add(FileName) 'TC log File Attached
objMailItem.Send
Set objMailItem = Nothing
Set objOutlook = Nothing
End Sub
Note - This code is export the Test log and send attachement of log (If log size is more, then outlook error may appear)