From 40bdeceff849ad73107deb3997b7eba1387362be Mon Sep 17 00:00:00 2001 From: vyshane Date: Wed, 14 Feb 2007 07:22:09 +0000 Subject: [PATCH] Merged from 1.7. --- lib/phpmailer/README_MOODLE.txt | 9 +++++++ lib/phpmailer/class.phpmailer.php | 40 ++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 lib/phpmailer/README_MOODLE.txt diff --git a/lib/phpmailer/README_MOODLE.txt b/lib/phpmailer/README_MOODLE.txt new file mode 100644 index 0000000000..3f57d592c6 --- /dev/null +++ b/lib/phpmailer/README_MOODLE.txt @@ -0,0 +1,9 @@ +Moodle-specific changes to phpmailer are tracked here. + + + lib/phpmailer/class.phpmailer.php + + Changed by: Vy-Shane Sin Fat + Date: 14 Feb 2007 + Reason: http://tracker.moodle.org/browse/MDL-3681 + diff --git a/lib/phpmailer/class.phpmailer.php b/lib/phpmailer/class.phpmailer.php index 73a40dfa48..2cd5cfc725 100644 --- a/lib/phpmailer/class.phpmailer.php +++ b/lib/phpmailer/class.phpmailer.php @@ -811,7 +811,45 @@ class PHPMailer if($this->Mailer != "mail") $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject))); - $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); + /** + * BEGIN original phpmailer code + * + * Commented out is the original line we are replacing. + * Vy-Shane Sin Fat , 14 Feb 2007. + */ + //$result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); + /** + * END original phpmailer code + */ + + /** + * BEGIN custom Moodle code + * + * This change is made necessary by MDL-3681. The Moodle forum module + * adds Message-ID as a custom header for each forum post mailout. + * This is used to help email clients display the messages in a + * threaded view. However, phpmailer also adds it's own Message-ID + * to every email that it sends. We want this to happen only if we + * haven't defined our own custom Message-ID for the email. + * + * Vy-Shane Sin Fat , 14 Feb 2007. + */ + $needmessageid = true; + + for($i=0; $iCustomHeader); $i++) + { + if (strtolower(trim($this->CustomHeader[$i][0])) == 'message-id') { + $needmessageid = false; + break; + } + } + if ($needmessageid) { + $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); + } + /** + * END custom Moodle code + */ + $result .= $this->HeaderLine("X-Priority", $this->Priority); $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]"); -- 2.39.5