Exemplo n.º 1
0
     foreach ($arFiles as $file) {
         if (strlen($file["name"]) > 0 and intval($file["size"]) > 0) {
             $resultInsertAttachFile = false;
             $file["MODULE_ID"] = "main";
             $fid = intval(CFile::SaveFile($file, "sender", true));
             if ($fid > 0) {
                 $resultAddAttachFile = \Bitrix\Sender\MailingAttachmentTable::add(array('CHAIN_ID' => $ID, 'FILE_ID' => $fid));
                 $resultInsertAttachFile = $resultAddAttachFile->isSuccess();
             }
             if (!$resultInsertAttachFile) {
                 break;
             }
         }
     }
     // save email to list of emails from
     \Bitrix\Sender\MailingChainTable::setEmailFromToList($EMAIL_FROM);
     // save template body to my templates
     if (isset($TEMPLATE_ACTION_SAVE) && $TEMPLATE_ACTION_SAVE == 'Y') {
         if (!empty($TEMPLATE_ACTION_SAVE_NAME) && !empty($MESSAGE)) {
             \Bitrix\Sender\TemplateTable::add(array('NAME' => $TEMPLATE_ACTION_SAVE_NAME, 'CONTENT' => $MESSAGE));
         }
     }
     if ($apply != "") {
         LocalRedirect("/bitrix/admin/sender_mailing_chain_edit.php?MAILING_ID=" . $MAILING_ID . "&ID=" . $ID . "&lang=" . LANG . "&" . $tabControl->ActiveTabParam());
     } else {
         LocalRedirect("/bitrix/admin/sender_mailing_chain_admin.php?MAILING_ID=" . $MAILING_ID . "&lang=" . LANG);
     }
 } else {
     if ($e = $APPLICATION->GetException()) {
         $arError[] = GetMessage("rub_save_error");
     }