Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save kovalev-org/459592 to your computer and use it in GitHub Desktop.

Select an option

Save kovalev-org/459592 to your computer and use it in GitHub Desktop.
<?
// регистрируем обработчики
AddEventHandler("subscribe", "BeforePostingSendMail", Array("MyClass", "BeforePostingSendMailHandler"));
class MyClass
{
// создаем обработчик события "BeforePostingSendMail"
/* если в теме рассылки будет команда [[email protected]], то на [email protected] будет запрошено уведомление о прочтении писем */
function BeforePostingSendMailHandler($arFields)
{
if (preg_match('/\[notify=(?P<email>[\w-]+?@[\w-]+?\.\w+?)\](?P<subj>.*)/i', $arFields["SUBJECT"], $regs)) {
$arFields["SUBJECT"]=$regs['subj'];
$arFields["HEADER"].="\n".'Disposition-Notification-To: '.$regs['email'];
}
return $arFields;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment