Contributions
- 3.3KViews0likes2Comments
- 3.3KViews0likes4Comments
Re: send emails - body of the message
I have tried this and I was able to parse the below into the body of email Total Test Items:15 Total Errors:2 Total Warnings:1 var mesg = "Test Results" ; var body = mesg + "<br />"+ "<br />" "Total number of project test items:" + Project.TestItems.ItemCount + "<br />"+ "<br />" +"Total Errors:" + Log.ErrCount + "<br />" + "<br />" + "Total Warnings:" + Log.WrnCount; -------------------------------------- I still need to get the below info added to the body: Name of the project Result: Pass or Fail Total Executed project test items: 1 Passed: 1 Failed: 13.3KViews0likes6Comments- 3.3KViews0likes7Comments
send emails - body of the message
Hi All, I have a send email script that will emails the test results with the attachment (.mht) through zip file I want to have the body of the message with the below information: Test : Test project name Result: Success or Error Test started: 01/01/2016 12:01:00 AM Test stopped: 01/01/2016 12:01:00 AM Test duration: 1 m 5 s Details: Total number of project test items: 10 Executed project test items: 10 Project Test Item Results Passed: 10, including 0 warning(s) Failed: 0 Please advise on how to have this info in the emails so that it wont be necassary to open the .mht attachment every time Thanks in Advance! ----------------------------------------------------------------------------------- /***** HERE IS THE SCRIPT I AM USING ****/ var message = "Attached Test Results "; function SendResults() { var ArchivePath = ""; //Project.ConfigPath + "Log\\TestResults.zip"; aqFileSystem.DeleteFolder("c:\\results\\testresults\\", true);//results /* results directory*/ ArchivePath = "c:\\results\\testresults\\TestResults.mht"; Log.SaveResultsAs(ArchivePath,2 , false); var fileList = slPacker.GetFileListFromFolder("c:\\results\\testresults\\"); slPacker.Pack(fileList, "c:\\results\\testresults\\", "c:\\results\\testresults\\TestResults.zip"); //slPacker.PackCurrentTest(ArchivePath); SendEmail("from@gmail.com", "to@gmail.com", "Notification - TestResults", message, "c:\\results\\testresults\\TestResults.zip"); } function SendEmail(mFrom, mTo, mSubject, mBody, mAttachment) { var smtpServer = "smtp.gmail.com"; var smtpPort = 465; var userLogin = "username"; var userPassword = "password"; var autentificationType = 1; var connectionTimeout = 60; var useSSL = true; try { var schema = "http://schemas.microsoft.com/cdo/configuration/"; var mConfig = Sys.OleObject("CDO.Configuration"); mConfig.Fields.Item(schema + "sendusing") = 2; // cdoSendUsingPort mConfig.Fields.Item(schema + "smtpserver") = smtpServer; mConfig.Fields.Item(schema + "smtpserverport") = smtpPort; mConfig.Fields.Item(schema + "sendusername") = userLogin; mConfig.Fields.Item(schema + "sendpassword") = userPassword; mConfig.Fields.Item(schema + "smtpauthenticate") = autentificationType; mConfig.Fields.Item(schema + "smtpusessl") = useSSL; mConfig.Fields.Item(schema + "smtpconnectiontimeout") =connectionTimeout; mConfig.Fields.Update(); var mMessage = Sys.OleObject("CDO.Message"); mMessage.Configuration = mConfig; mMessage.From = mFrom; mMessage.To = mTo; mMessage.Subject = mSubject; mMessage.HTMLBody = mBody; //if(0 < mAttachment.length) { mMessage.AddAttachment(mAttachment); //} mMessage.Send(); } catch(exception) { Log.Error("E-mail cannot be sent", exception.description); return false; } Log.Message("TestResults to <" + mTo + "> was successfully sent"); return true; }3.5KViews0likes11Commentsunable to send emails
I am unable to send emails in testcompelte, the test log shows emails cannot be sent, Please help me fix the below code I am using the below code: function Test() { SendEmail("test@gmail.com", "test@gmail.com", "Test", "TestMessage", ""); } function SendEmail(mFrom, mTo, mSubject, mBody, mAttachment) { var smtpServer = "smtp.gmail.com"; var smtpPort = 587; var userLogin = "testuser"; var userPassword = "testpassword"; var autentificationType = 1; var connectionTimeout = 60; var useSSL = true; try { var schema = "http://schemas.microsoft.com/cdo/configuration/"; var mConfig = Sys.OleObject("CDO.Configuration"); mConfig.Fields.Item(schema + "sendusing") = 2; // cdoSendUsingPort mConfig.Fields.Item(schema + "smtpserver") = smtp.googlemail.com; mConfig.Fields.Item(schema + "smtpserverport") = 465; mConfig.Fields.Item(schema + "sendusername") = userLogin; mConfig.Fields.Item(schema + "sendpassword") = userPassword; mConfig.Fields.Item(schema + "smtpauthenticate") = autentificationType; mConfig.Fields.Item(schema + "smtpusessl") = useSSL; mConfig.Fields.Item(schema + "smtpconnectiontimeout") =connectionTimeout; mConfig.Fields.Update(); var mMessage = Sys.OleObject("CDO.Message"); mMessage.Configuration = mConfig; mMessage.From = mFrom; mMessage.To = mTo; mMessage.Subject = mSubject; mMessage.HTMLBody = mBody; if(0 < mAttachment.length) { mMessage.AddAttachment(mAttachment); } mMessage.Send(); } catch(exception) { Log.Error("E-mail cannot be sent", exception.description); return false; } Log.Message("Message to <" + mTo + "> was successfully sent"); return true; }1.1KViews0likes2CommentsUnable to view .MHT file on Outlook
Hi, I have my script that will email my test results log to my outlook I am getting the .mht file to my email but I cant view the testresult, when I download the file and open in IE it works fine Is there any workaround that can fix this issue I want to view my test result directly on my outlook , so that its easy for me to view everday Thank you in advance!1.2KViews0likes2Comments