Exemplo n.º 1
0
if ($_REQUEST["action"] == "send_to_me" && check_bitrix_sessid() && $POST_RIGHT >= "W") {
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_js.php";
    $adminMessage = new CAdminMessage('');
    $sendToMeAddr = $_POST["send_to_me_addr"];
    $sendToMeAddr = explode(",", $sendToMeAddr);
    $arResult = array();
    $mailingChain = MailingChainTable::getRowById(array('ID' => $ID));
    if ($mailingChain) {
        try {
            foreach ($sendToMeAddr as $address) {
                $address = trim($address);
                if (!empty($address)) {
                    $sendResult = \Bitrix\Sender\PostingManager::sendToAddress($mailingChain['ID'], $address);
                    if ($sendResult == \Bitrix\Sender\PostingManager::SEND_RESULT_SENT) {
                        $arResult[] = $address;
                        MailingChainTable::setEmailToMeList($address);
                    }
                }
            }
            if (!empty($arResult)) {
                $adminMessage->ShowNote(GetMessage("sender_mailing_chain_adm_test_send_success") . implode(', ', $arResult));
            } else {
                $adminMessage->ShowMessage(GetMessage("sender_mailing_chain_adm_test_send_empty"));
            }
        } catch (Exception $e) {
            $adminMessage->ShowMessage($e->getMessage());
        }
    } else {
        $adminMessage->ShowMessage(GetMessage("MAILING_ADM_POST_NOT_FOUND"));
    }
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin_js.php";