Documentation

OnBeforeSendMailToSupport

Description and parameters

handler function(
 array $arFields,
 bool $is_new
)
The event "OnBeforeSendMailToSupport" is called directly before sending email to an employee in the Support module. Usually, the objective of this event handler is to execute a specific action before sending an e-mail.

Parameters

Parameter Description
$arFields

Array contains event parameters, passed to an event handler.

Array example:
Array
(
    [ID] => 1
    [LANGUAGE] => en
    [LANGUAGE_ID] => en
    [WHAT_CHANGE] => < added message >

    [DATE_CREATE] => 24.07.2011 19:22:38
    [TIMESTAMP] => 24.07.2011 20:19:57
    [DATE_CLOSE] => 
    [TITLE] => My first message
    [STATUS] => "Problem solving in progress" status
    [DIFFICULTY] => Medium
    [CATEGORY] => General
    [CRITICALITY] => High
    [RATE] => 
    [SLA] => By default
    [SOURCE] => 
    [MESSAGES_AMOUNT] => 10
    [SPAM_MARK] => 
    [ADMIN_EDIT_URL] => /bitrix/admin/ticket_edit.php
    [PUBLIC_EDIT_URL] => /communication/support/
    [OWNER_EMAIL] => mifd@dfdf.com
    [OWNER_USER_ID] => 2
    [OWNER_USER_NAME] => John Smith
    [OWNER_USER_LOGIN] => bx_test
    [OWNER_USER_EMAIL] => mifd@dfdf.com
    [OWNER_TEXT] => [2] (bx_test) John Smith
    [OWNER_SID] => 
    [SUPPORT_EMAIL] => my@email.com
    [RESPONSIBLE_USER_ID] => 
    [RESPONSIBLE_USER_NAME] =>  
    [RESPONSIBLE_USER_LOGIN] => 
    [RESPONSIBLE_USER_EMAIL] => 
    [RESPONSIBLE_TEXT] => 
    [SUPPORT_ADMIN_EMAIL] => 
    [CREATED_USER_ID] => 2
    [CREATED_USER_LOGIN] => bx_test
    [CREATED_USER_EMAIL] => mifd@dfdf.com
    [CREATED_USER_NAME] => John Smith
    [CREATED_MODULE_NAME] => 
    [CREATED_TEXT] => [2] (bx_test) John Smith
    [MODIFIED_USER_ID] => 2
    [MODIFIED_USER_LOGIN] => bx_test
    [MODIFIED_USER_EMAIL] => mifd@dfdf.com
    [MODIFIED_USER_NAME] => John Smith
    [MODIFIED_MODULE_NAME] => 
    [MODIFIED_TEXT] => [2] (bx_test) John Smith
    [MESSAGE_AUTHOR_USER_ID] => 2
    [MESSAGE_AUTHOR_USER_NAME] => John Smith
    [MESSAGE_AUTHOR_USER_LOGIN] => bx_test
    [MESSAGE_AUTHOR_USER_EMAIL] => mifd@dfdf.com
    [MESSAGE_AUTHOR_TEXT] => [2] (bx_test) John Smith
    [MESSAGE_AUTHOR_SID] => 
    [MESSAGE_SOURCE] => 
    [MESSAGE_HEADER] => ======================= MESSAGE ==================================
    [MESSAGE_BODY] => 

Your query has been solved successfully.

    [MESSAGE_FOOTER] => ====================================================================
    [FILES_LINKS] => 
    [IMAGE_LINK] => 
    [SUPPORT_COMMENTS] => 
)
 
$is_new Contains true in case of first message in query, otherwise returns false

Returned value

Returns set of e-mail fields

See Also

Handler function example

<?
//Handler in file /bitrix/php_interface/init.php
//Duplicate email in a social network message
AddEventHandler("support", "OnBeforeSendMailToSupport", array("MyClass", "OnBeforeSendMailToSupportHandler"));
class MyClass
{
	public static function OnBeforeSendMailToSupportHandler($arFields, $is_new)
	{
		if (CModule::IncludeModule("socialnetwork"))
		{
			$servername = "site.ru";
			$message = "";
			$message .= "Тема: ".$arFields["TITLE"]."[".$arFields["ID"]."] (Query edited)\r\n";
			$message .= $arFields["WHAT_CHANGE"]."\r\n";
			$message .= "От кого: ".$arFields["MESSAGE_SOURCE"]." ".$arFields["MESSAGE_AUTHOR_SID"]." ".$arFields["MESSAGE_AUTHOR_TEXT"]."\r\n";
			$message .= $arFields["MESSAGE_HEADER"];
			$message .= $arFields["MESSAGE_BODY"];
			$message .= $arFields["MESSAGE_FOOTER"]."\r\n";
			$message .= "For viewing and editing the query, use the link:\r\n";
			$message .= "http://".$servername.$arFields["ADMIN_EDIT_URL"]."?ID=".$arFields["ID"]."\r\n";
			
			$arPamams = array( 
				"FROM_USER_ID" => 1, 
				"TO_USER_ID" => 1, 
				"MESSAGE" => $message, 
				"=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), 
				"MESSAGE_TYPE" => "P", 
			); 
			CSocNetMessages::Add($arPamams);
		}
	}
}


?>


© «Bitrix24», 2001-2024
Up