Contributions
Re: SendMail not working. Tried everything I found in documentation and forum. Need help.
I have tried to use the entire email address (username@gmail.com) with port 465. That did not make any difference. I read that with gmail I need to use SSL, is that true? I asked my manager if any of the ports in question are blocked, he was not sure. I need to talk to the network guys to make sure they are not blocked. If you have any other solutions, I would love to hear it. Once again, I really appreciate your time and effort trying to help me! Thank you! Dave1.4KViews0likes0CommentsRe: SendMail not working. Tried everything I found in documentation and forum. Need help.
I think we are making some proress! It is going through every line till - mMessage.Send(); ... and then the exception takes place at the above line? I guess for some reason it can't send the message!!2.2KViews0likes6CommentsRe: SendMail not working. Tried everything I found in documentation and forum. Need help.
Okay, I changed them to: mConfig.Fields.Item(schema + "sendusing").Value = 2; // cdoSendUsingPort mConfig.Fields.Item(schema + "smtpserver").Value = smtpServer; mConfig.Fields.Item(schema + "smtpserverport".Value) = smtpPort; mConfig.Fields.Item(schema + "sendusername").Value = userLogin; mConfig.Fields.Item(schema + "sendpassword").Value = userPassword; mConfig.Fields.Item(schema + "smtpauthenticate").Value = autentificationType; mConfig.Fields.Item(schema + "smtpconnectiontimeout").Value = connectionTimeout; mConfig.Fields.Item(schema + "smtpusessl").Value = useSSL; mConfig.Fields.Update(); Still getting the same error! :(2.2KViews0likes8CommentsRe: SendMail not working. Tried everything I found in documentation and forum. Need help.
Hi Robert, Ran the test as suggested - It steps through till - mConfig.Fields.Item(schema + "sendusing") = 2; Then jumps to: Log.Error("E-mail cannot be sent", exception.description); Thanks.2.2KViews0likes10CommentsSendMail not working. Tried everything I found in documentation and forum. Need help.
In gmail,2-step verification is turned off. Account access is enabled. Less secure app access is turned on. There is a log file here: C:\\TestLog\\Log.mht The script I am using: function Test() { SendEmail("xxxxn@gmail.com", "xxxx@xxxxxxxxx.com", "Test", "TestMessage", "C:\\TestLog\\Log.mht"); } function SendEmail(mFrom, mTo, mSubject, mBody, mAttachment) { var smtpServer = "smtp.gmail.com" //"smtp.gmail.com"; var smtpPort = 587; //tried 587, 465, 26 & 25 as well var userLogin = "xxxx"; // e.g. "abc" if the address is abc@gmail.com var userPassword = "PASSWORD"; var autentificationType = 1; // cdoBasic var connectionTimeout = 30; var useSSL = true;// Required by Gmail 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 + "smtpconnectiontimeout") = connectionTimeout; mConfig.Fields.Item(schema + "smtpusessl") = useSSL; 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; } Log reports: 'E-mail cannot be sent', Additional Info panel is blank. Help is much appreciated. Dave2.9KViews0likes13CommentsRe: Need help with 'GeneralEvents_OnLogError'
Hi Robert Thanks for your and Alex's insight. I got it to work. To your point "...make sure you've flushed the latest entries to disk before you do the export.". I have done this: var sPath = "C:\\TestLog\\Log.mht"; if (aqFileSystem.Exists(sPath)) aqFileSystem.DeleteFile(sPath); I thought it should delete the last 'Log.mht' file. If I am wrong, can you please tell me how I should do just that? Regards. Dave1.7KViews0likes1CommentNeed help with 'GeneralEvents_OnLogError'
Hi All I am trying to save the log when TestComplete encounters an error and stops. After much reading, searching I have this bit working. function swceLogin(){ Browsers.Item("iexplore").Run("[APPLICATION URL]"); var browser = Sys.Browser("iexplore"); var page = browser.Page("*THC*"); var userName = page.FindChildEx("idStr", "txtUserName", 10, true, 10000); var userPass = page.FindChild("idStr", "txtPassword", 10); var btnLogin = page.FindChild("idStr", "lnkLogin", 10); userName.SetText("[USER]"); userPass.SetText("[PASSWORD]"); btnLogin.ClickButton(); var pName = page.FindChild("idStr", "Name", 15); //wrong valu for 'idStr' for the test to fail var btnSearch = page.FindChild("idStr", "ctl00_masterBodyContent_LinkButtonSearch", 15); pName.SetText("Morgan, Tom"); // test fails here btnSearch.ClickButton(); } function GeneralEvents_OnLogError(Sender, LogParams){ var sPath = "C:\\TestLog\\Log.mht"; if (aqFileSystem.Exists(sPath)) aqFileSystem.DeleteFile(sPath); Log.SaveResultsAs("C:\\TestLog\\Log.mht", lsMHT, false, lesCurrentTestItem); } Problem is, the log does not contain the error message that caused the script to stop! Is there a way to save the log that includes the error message? Thanks in advance for any help.Solved1.7KViews0likes5Comments