Answer the question
In order to leave comments, you need to log in
How to organize a mailing list for a 1C-Bitrix event?
There are actually two questions: 1. Is it possible to automatically generate a newsletter after publishing an article on the site. 2. Is it possible to subscribe to a new article only for a specific subsection or subsections, but not all articles in the general Articles section.
1C-Bitrix has a Subscription and mailings module. In the settings, it is possible to send a letter according to a schedule, at a certain time, day of the week, date, by event, no. I think to use this module, the only thing is not clear how to fasten the sending on the event of adding an article / news on the site.
Answer the question
In order to leave comments, you need to log in
// создаем обработчик события "OnAfterIBlockElementAdd"
AddEventHandler("iblock", "OnAfterIBlockElementAdd", "OnAfterIBlockElementAddCustom");
function OnAfterIBlockElementAddCustom(&$arFields)
{
//todo: здесь сделать проверку на нужный ИБ
CModule::IncludeModule('subscribe');
$posting = new CPosting;
$postingFields = array(
'STATUS' => 'D',
'DIRECT_SEND' => 'Y',
'FROM_FIELD' => '[email protected]',
'SUBJECT' => 'Рассылка',
'BODY' => 'Проверка связи',
'BODY_TYPE' => 'html',
'CHARSET' => 'UTF-8'
);
$ID = $posting->Add($postingFields);
if ($ID == false) {
AddMessage2Log($posting->LAST_ERROR);
}
}
This is achieved by modifications and events:
OnAfterIBlockElementAdd
https://dev.1c-bitrix.ru/api_help/iblock/events/on...
CEvent::Send
https://dev.1c-bitrix.ru/api_help/main/reference /c...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question