From 1fd9f5e1fbcb3f7ca1b6c1e501aefa9b88c98995 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 14 Jan 2017 13:27:44 +0100 Subject: [PATCH] Fix: host was twice into message id for smtp driver and swiftmailer was not using dol_getprefix() to build host. --- htdocs/core/class/CMailFile.class.php | 6 ++++-- htdocs/core/class/smtps.class.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 26f8a4b88f2..44df05a4d6c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -365,7 +365,9 @@ class CMailFile { // Use Swift Mailer library // ------------------------------------------ - + + $host = dol_getprefix('email'); + require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; // Create the message $this->message = Swift_Message::newInstance(); @@ -373,7 +375,7 @@ class CMailFile // Adding a trackid header to a message $headers = $this->message->getHeaders(); $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid); - $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $conf->global->MAIN_MAIL_SMTP_SERVER; + $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host; $msgid = $headers->get('Message-ID'); $msgid->setId($headerID); $headers->addIdHeader('References', $headerID); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 0517dee30e5..37c0772093f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1190,7 +1190,7 @@ class SMTPs $host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix - $host=dol_getprefix('email').'-'.$host; + $host=dol_getprefix('email'); //NOTE: Message-ID should probably contain the username of the user who sent the msg $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; -- GitLab