Bitrix Site Manager

CEventMessage::Add

mixed
CEventMessage::Add(
 array fields
)

The method Add adds a new mail template. Returns ID of the added template. In case of error the method will return false, and the LAST_ERROR property will contain the error description.

Parameters

ParameterDescription
fields The array of field values of the format array("field"=>"value" [, ...]). The fields can be the following:
  • ACTIVE - mail template active state flag: "Y" - active; "N" - inactive;
  • EVENT_NAME - the mail event type ID;
  • SITE_ID - site ID;
  • EMAIL_FROM - the "From" field;
  • EMAIL_TO - the "To" field;
  • BCC - the "BCC" field; 
  • SUBJECT - massage header;
  • BODY_TYPE - type of the mail message: "text" or "html";
  • MESSAGE - message body.

See Also

Example



<?
$arr["ACTIVE"] = "Y";
$arr["EVENT_NAME"] = "ADV_CONTRACT_INFO";
$arr["SITE_ID"] = array("ru","en");
$arr["EMAIL_FROM"] = "#DEFAULT_EMAIL_FROM#";
$arr["EMAIL_TO"] = "#EMAIL_TO#";
$arr["BCC"] = "#BCC#";
$arr["SUBJECT"] = "subject";
$arr["BODY_TYPE"] = "text";
$arr["MESSAGE"] = "
Message body
";

$emess = new CEventMessage;
$emess->Add($arr);
?>