X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=phpmailer%2Fphpmailer.php;h=3a8898b414b9eaf2ce5a7f8c1ca91af766c53165;hb=be62a9a3696ea4158c3c4f703cd5c5cd61c03a90;hp=5b43c8f19b00518bb792eb962919b1f8571fbb32;hpb=5663e61791e996cbfbadff116481f6e20e0639cb;p=friendica-addons.git diff --git a/phpmailer/phpmailer.php b/phpmailer/phpmailer.php index 5b43c8f1..3a8898b4 100644 --- a/phpmailer/phpmailer.php +++ b/phpmailer/phpmailer.php @@ -20,7 +20,7 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'a function phpmailer_install() { Hook::register('load_config' , __FILE__, 'phpmailer_load_config'); - Hook::register('emailer_send_prepare', __FILE__, 'phpmailer_emailer_send_prepare'); + Hook::register('emailer_send_prepare', __FILE__, 'phpmailer_emailer_send_prepare', 5); } function phpmailer_load_config(App $a, ConfigFileLoader $loader) @@ -37,14 +37,14 @@ function phpmailer_emailer_send_prepare(App $a, IEmail &$email) // Passing `true` enables exceptions $mailer = new PHPMailer(true); try { + // Setup encoding. + $mailer->CharSet = 'UTF-8'; + $mailer->Encoding = 'base64'; + if (DI::config()->get('phpmailer', 'smtp')) { // Set mailer to use SMTP $mailer->isSMTP(); - // Setup encoding. - $mailer->CharSet = 'UTF-8'; - $mailer->Encoding = 'base64'; - // Specify main and backup SMTP servers $mailer->Host = DI::config()->get('phpmailer', 'smtp_server'); $mailer->Port = DI::config()->get('phpmailer', 'smtp_port'); @@ -92,7 +92,7 @@ function phpmailer_emailer_send_prepare(App $a, IEmail &$email) if (!empty($email->getAdditionalMailHeader())) { foreach ($email->getAdditionalMailHeader() as $name => $values) { // Set the "Message-ID" header for PHP-Mailer directly - if ($name == 'Message-Id') { + if (strtolower($name) === 'message-id') { // implode all values to one entry, because there's only one value possible $mailer->MessageID = trim(implode("", $values)); } else {