From: Suresh K. <sur...@gm...> - 2014-07-24 12:25:20
|
How to send executed suite report through email. Steps done: SET SAHI_EXT_CLASS_PATH=%SAHI_USERDATA_DIR%\extlib\mail\mail.jar;%SAHI_USERDATA_DIR%\extlib\mail\activation.jar;%SAHI_HOME%\lib\ant-sahi.jar; Code: function sendEmail($emailSubject, $emailBody) { var $host = "smtp.gmail.com"; var $port = 465; var $username = "ab...@gm..."; var $password = "11111"; var $isSSL = true; // set to true if you use SSL var $mailer = new Packages.net.sf.sahi.ant.Mailer($host, $port, $username, $password, $isSSL); var $from = "ab...@gm..."; var $to = "ab...@gm..."; $mailer.send($from, $to, $emailSubject, $emailBody); } sendEmail("Mail from Sahi", "All izz well"); function onScriptEnd(){ var $status = _scriptStatus(); // "FAILURE" or "SUCCESS" var $scriptName = _scriptName(); var $scriptPath = _scriptPath(); // Script name with full file path sendEmail($status + ": " + $scriptName, "Script: " + $scriptPath + "\nStatus: " + $status); } *Error:ERROR[1 ms] [05:39:03.948] * *TypeError: [JavaPackage net.sf.sahi.ant.Mailer] is not a function, it is object.* |