L
L
lotoseu2021-06-04 10:09:17
PHP
lotoseu, 2021-06-04 10:09:17

How to set up sending emails via Event::send?

Hello! Emails are not sent from the site. An interesting fact is that the letter is sent from the admin panel, but not from the site. Using the php command line, letters were sent using the Event::send and CEvent::Send methods, in the first case the letter was sent, in the second - no, but the message showed that "successfully sent" in the sql table b_event the letter has the status SUCCESS_EXEC = F. Not I can understand where CEvent::Send is registered, please help
me 1st check Event::send

use Bitrix\Main\Mail\Event;
$arFields = array(
    "EVENT_NAME" => "SALE_NEW_ORDER",
    "LID" => "s1",
    "C_FIELDS" => array(
    "EMAIL"    => "[email protected]",
    "BCC"    => "[email protected]",
    "DEFAULT_EMAIL_FROM"    => "[email protected]",
    ),
    "DUPLICATE"=>"Y",
);
$result=Event::send($arFields);
if($result->GetId()){
    echo 'Успешно отправлено!';
}else{
    echo 'Отправка не удалась!';
}


2nd check CEvent::Send

$arEventFields = array(
     "EMAIL_TO"            => "[email protected]",
    "BCC"                 => "[email protected]",
   "DEFAULT_EMAIL_FROM"    => "[email protected]",
    "ORDER_LIST"    => "состав заказа",
    );
$result=CEvent::Send("SALE_NEW_ORDER", "s1", $arEventFields,'Y');
if(intval($result)){
    echo 'Успешно отправлено!';
}else{
    echo 'Отправка не удалась!';
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question