Forum Discussion
SaravanaKumar_N
6 years agoContributor
You might have to use CDO here. This is what we do...
More details here -
function SendEmail() { var mBody = "C:\\Report.html"; // Your HTML file location var schema, mConfig, mMessage; var cdoSendUsingPort = 2; var emailSMTPServer; // Your office SMTP server details, will be able to get these from your System Admin. var smtpServerPortNumber = 25; // This should work, if not get the SMTP server port details as well var smtpAuthentication = 1; try { schema = "http://schemas.microsoft.com/cdo/configuration/"; mConfig = Sys.OleObject("CDO.Configuration"); mConfig.Fields.Item(schema + "sendusing") = cdoSendUsingPort; mConfig.Fields.Item(schema + "smtpserver") = emailSMTPServer; mConfig.Fields.Item(schema + "smtpserverport") = smtpServerPortNumber; mConfig.Fields.Item(schema + "smtpauthenticate") = smtpAuthentication; // mConfig.Fields.Item(schema + "sendusername") = ""; // User name (if needed) // mConfig.Fields.Item(schema + "sendpassword") = ""; // User password (if needed) mConfig.Fields.Update(); mMessage = Sys.OleObject("CDO.Message"); mMessage.Configuration = mConfig; mMessage.From = <enter EmailSender details>; mMessage.To = <enter EmailRecipients details>; mMessage.Cc = <enter EmailCCRecipents details>; mMessage.Subject = <enter Email Subject details>; var str = aqFile.ReadWholeTextFile(mBody, aqFile.ctANSI); mMessage.HTMLBody = str; mMessage.Send(); Log.Message("Message was sent successfully."); return true; } catch (exception) { TestLog.Warning("E-mail cannot be sent", exception.description); return false; } }
Related Content
- 3 years ago
Recent Discussions
- 2 days ago