]> git.mxchange.org Git - friendica-addons.git/blobdiff - phpmailer/phpmailer.php
Merge pull request #1130 from MrPetovan/bug/notices
[friendica-addons.git] / phpmailer / phpmailer.php
index 5b43c8f19b00518bb792eb962919b1f8571fbb32..3a8898b414b9eaf2ce5a7f8c1ca91af766c53165 100644 (file)
@@ -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 {