Skip to content

Instantly share code, notes, and snippets.

@dnikonov
Created December 7, 2019 14:47
Show Gist options
  • Save dnikonov/a9a0a2ab4b2496a89e3f887d8ef32458 to your computer and use it in GitHub Desktop.
Save dnikonov/a9a0a2ab4b2496a89e3f887d8ef32458 to your computer and use it in GitHub Desktop.
//init.php
if (!function_exists('custom_mail') && COption::GetOptionString("webprostor.smtp", "USE_MODULE") == "Y") {
function custom_mail($to, $subject, $message, $additional_headers='', $additional_parameters=''){
if (CModule::IncludeModule("webprostor.smtp")) {
// исправляю переносы строк в заголовках
if (!empty($additional_headers)) {
$additional_headers = str_replace("\r\n", "\n", $additional_headers); // на случай если уже нормальные переносы
$additional_headers = str_replace("\n", "\r\n", $additional_headers);
}
$smtp = new CWebprostorSmtp("s1");
$result = $smtp->SendMail($to, $subject, $message, $additional_headers, $additional_parameters);
return $result ? true : false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment