How to use Sendmail attachment as Insert as Text to display Body as Summary Format
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2018
12:46 AM
09-18-2018
12:46 AM
How to use Sendmail attachment as Insert as Text to display Body as Summary Format
Am using Send mail Method of Testcomplete in the Attachment i would like to use "Outlook--> Insert as Text"
so that my HTML Summary report would get printed in the Body of the email
SendMail(emailRecipients, "smtp.gmail.com", From_Mail , "", Subject, Body_mail, Attachment);
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2018
10:13 AM
11-14-2018
10:13 AM
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; } }
