Your UX is waiting ...interact, engage, explore in Las Vegas at CloudWorld 2023

Learn more
Error class\RightNow\Connect\v1_2\MailMessage not found in custom process. — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Error class\RightNow\Connect\v1_2\MailMessage not found in custom process.

Accepted answer
35
Views
2
Comments
edited Jun 8, 2022 12:01PM in General Technical Discussions 2 comments

Version

Feb 14

Code Snippet

             <?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 = "[email protected]";
				$to = "[email protected]";
				$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

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!