CAdvContract :: SendEMail: Bitrix method

      
<?php 
//  CAdvContract :: SendEMail()
//  /dist/bitrix/modules/advertising/classes/general/advertising.php:386

    
public static function SendEMail($arContract$mess="")
    {
        
$CONTRACT_ID $arContract["ID"];

        
$BCC = array();
        
$OWNER_EMAIL = array();
        
$ADD_EMAIL = array();
        
$EDIT_EMAIL = array();

        
$MANAGER_EMAIL CAdvContract::GetManagerEmails();
        
$ADMIN_EMAIL CAdvContract::GetAdminEmails();
        
$ADMIN_EMAIL array_merge($MANAGER_EMAIL$ADMIN_EMAIL);
        
$ADMIN_EMAIL array_unique($ADMIN_EMAIL);
        
CAdvContract::GetOwnerEmails($CONTRACT_ID$OWNER_EMAIL$ADD_EMAIL$VIEW_EMAIL$EDIT_EMAIL);

        
$EMAIL_TO $OWNER_EMAIL;
        if (
count($EMAIL_TO)<=0)
        {
            
$EMAIL_TO $ADMIN_EMAIL;
        }
        else 
$BCC $ADMIN_EMAIL;

        
$CREATED_BY $MODIFIED_BY "";
        if (
intval($arContract["CREATED_BY"])>0)
        {
            
$rsUser CUser::GetByID($arContract["CREATED_BY"]);
            if (
$arUser $rsUser->Fetch())
            {
                
$CREATED_BY "[".$arUser["ID"]."] (".$arUser["LOGIN"].") ".$arUser["NAME"]." ".$arUser["LAST_NAME"];
            }
        }
        if (
intval($arContract["MODIFIED_BY"])==intval($arContract["CREATED_BY"]) && intval($arContract["CREATED_BY"])>0)
        {
            
$MODIFIED_BY $CREATED_BY;
        }
        elseif (
intval($arContract["MODIFIED_BY"])>0)
        {
            
$rsUser CUser::GetByID($arContract["MODIFIED_BY"]);
            if (
$arUser $rsUser->Fetch())
            {
                
$MODIFIED_BY "[".$arUser["ID"]."] (".$arUser["LOGIN"].") ".$arUser["NAME"]." ".$arUser["LAST_NAME"];
            }
        }
        if (
strlen($mess)>0)
            
$mess "\n".$mess."\n";
        
$description "";
        if (
strlen($arContract["DESCRIPTION"])>0)
            
$description "\n".$arContract["DESCRIPTION"]."\n";
        
$arEventFields = array(
            
"ID" => $CONTRACT_ID,
            
"MESSAGE" => $mess,
            
"EMAIL_TO" => implode(","$EMAIL_TO),
            
"ADMIN_EMAIL" => implode(","$ADMIN_EMAIL),
            
"ADD_EMAIL" => implode(","$ADD_EMAIL),
            
"STAT_EMAIL" => implode(","$VIEW_EMAIL),
            
"EDIT_EMAIL" => implode(","$EDIT_EMAIL),
            
"OWNER_EMAIL" => implode(","$OWNER_EMAIL),
            
"BCC" => implode(","$BCC),
            
"INDICATOR" => GetMessage("AD_".strtoupper($arContract["LAMP"]."_CONTRACT_STATUS")),
            
"ACTIVE" => $arContract["ACTIVE"],
            
"NAME" => $arContract["NAME"],
            
"DESCRIPTION" => $description,
            
"MAX_SHOW_COUNT" => $arContract["MAX_SHOW_COUNT"],
            
"SHOW_COUNT" => $arContract["SHOW_COUNT"],
            
"MAX_CLICK_COUNT" => $arContract["MAX_CLICK_COUNT"],
            
"CLICK_COUNT" => $arContract["CLICK_COUNT"],
            
"BANNERS" => $arContract["BANNER_COUNT"],
            
"DATE_SHOW_FROM" => $arContract["DATE_SHOW_FROM"],
            
"DATE_SHOW_TO" => $arContract["DATE_SHOW_TO"],
            
"DATE_CREATE" => $arContract["DATE_CREATE"],
            
"CREATED_BY" => $CREATED_BY,
            
"DATE_MODIFY" => $arContract["DATE_MODIFY"],
            
"MODIFIED_BY" => $MODIFIED_BY
        
);
        
$arrSITE =  CAdvContract::GetSiteArray($CONTRACT_ID);
        
CEvent::Send("ADV_CONTRACT_INFO"$arrSITE$arEventFields);
    }