- Модуль: subscribe
- Путь к файлу: ~/bitrix/modules/subscribe/classes/general/posting.php
- Класс: CPostingGeneral
- Вызов: CPostingGeneral::GetEmails
function GetEmails($post_arr)
{
$aEmail = array();
//send to categories
$aPostRub = array();
$post_rub = CPostingGeneral::GetRubricList($post_arr["ID"]);
while($post_rub_arr = $post_rub->Fetch())
$aPostRub[] = $post_rub_arr["ID"];
$subscr = CSubscription::GetList(
array("ID"=>"ASC"),
array("RUBRIC_MULTI"=>$aPostRub, "CONFIRMED"=>"Y", "ACTIVE"=>"Y",
"FORMAT"=>$post_arr["SUBSCR_FORMAT"], "EMAIL"=>$post_arr["EMAIL_FILTER"])
);
while(($subscr_arr = $subscr->Fetch()))
$aEmail[] = $subscr_arr["EMAIL"];
//send to user groups
$aPostGrp = array();
$post_grp = CPostingGeneral::GetGroupList($post_arr["ID"]);
while($post_grp_arr = $post_grp->Fetch())
$aPostGrp[] = $post_grp_arr["ID"];
if(count($aPostGrp)>0)
{
$user = CUser::GetList(
"id", "asc",
array("GROUP_MULTI"=>$aPostGrp, "ACTIVE"=>"Y", "EMAIL"=>$post_arr["EMAIL_FILTER"])
);
while(($user_arr = $user->Fetch()))
$aEmail[] = $user_arr["EMAIL"];
}
//from additional emails
$BCC = $post_arr["BCC_FIELD"];
if($post_arr["DIRECT_SEND"] == "Y")
$BCC .= ($BCC <> ""? ",":"").$post_arr["TO_FIELD"];
if($BCC <> "")
{
$BCC = str_replace("rn", "n", $BCC);
$BCC = str_replace("n", ",", $BCC);
$aBcc = explode(",", $BCC);
foreach ($aBcc as $bccEmail)
{
$bccEmail = trim($bccEmail);
if($bccEmail <> "")
$aEmail[] = $bccEmail;
}
}
$aEmail = array_unique($aEmail);
return $aEmail;
}