$ 0 0 Topic by Darpit PatelVersionFeb 14Code Block<?php /** * CPMObjectEventHandler: AnswerNotification * Package: RN * Objects: Answer * Actions: Update * Version: 1.2 */ use \RightNow\CPM\v1 as RNCPM; // This object event handler binds to v1_2 of the Connect for PHP API use RightNow\Connect\v1_2 as RNCPHP; require_once(get_cfg_var("doc_root") . "/ConnectPHP/Connect_init.php"); error_reporting(E_ALL); class AnswerNotification implements RNCPM\ObjectEventHandler { public static function apply($runMode, $action, $answer, $cycle) { if ($cycle !== 0) return; if(RNCPM\ActionUpdate == $action) { try { print_r("hello"); $emailfrom = "xyz@xyz.com"; $to = "abc@abc.com"; $mm = new RNCPHP\MailMessage(); $mm->To->EmailAddresses = array($to); $mm->Subject = 'sub'; $mm->Body->Text = 'abc'; $mm->Body->Html = 'abc'; $mm->Options->IncludeOECustomHeaders = false; $mm->send(); echo "<br>Sent."; print_r($success); //mail sending logic } catch(Exception $e) { echo "ConnectPHP error was: ".$e->getMessage(); phpoutlog("ConnectPHP exception in file: " . __FILE__ . ", ". __FUNCTION__ . " at line: " . __LINE__ . "\nException code : " . $e->getCode() . "\nException message : " . $e->getMessage()); throw $e; } } } }Image