From 33f0ae3f866a0512d88a627a76bae544db7ab385 Mon Sep 17 00:00:00 2001 From: Jacob Roeland Date: Sun, 4 Aug 2013 02:50:01 -0500 Subject: [PATCH 1/2] Fixed some Markdown formatting - Wrapped the "git remote set-url" command in Markdown code quotes - Added a link directly to the Changelog --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 671141da..1e154fdc 100644 --- a/README.md +++ b/README.md @@ -107,13 +107,13 @@ We're particularly interested in fixing edge-cases, expanding test coverage and With the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone: -git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git +`git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git` Please *don't* use the SourceForge or Google Code projects any more. ## Changelog -See changelog.md +See [changelog.md](changelog.md) ## History - PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/). From 091e776f16d8271877f293f449599166fcd9dc2e Mon Sep 17 00:00:00 2001 From: davidsickmiller Date: Fri, 30 Aug 2013 02:23:13 -0400 Subject: [PATCH 2/2] Added a function, GetLastMessageID, for accessing the last message ID Added a function, GetLastMessageID, for accessing the last message ID. It returns whatever message ID was used when the headers were last created, which is also the message ID of the last sent message except in failure cases. If the client sends multiple messages using the same PHPMailer object, the value returned by GetLastMessageID() will be updated each time. In issue #57, it was pointed out that a client wanting the message ID could just explicitly set the message ID via $this->MessageID, but that would require the client to understand how to create a good message ID. --- class.phpmailer.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/class.phpmailer.php b/class.phpmailer.php index d5b29fc5..1442365d 100644 --- a/class.phpmailer.php +++ b/class.phpmailer.php @@ -468,6 +468,11 @@ class PHPMailer { * @access protected */ protected $CustomHeader = array(); + /** + * @var string The most recent Message-ID (including angular brackets) + * @access protected + */ + protected $lastMessageID = ''; /** * @var string The message's MIME type * @access protected @@ -757,6 +762,17 @@ class PHPMailer { return true; } + /** + * Return the Message-ID header of the last email. + * Technically this is the value from the last time the headers were created, + * but it also the message ID of the last sent message except in + * pathological cases. + * @return string + */ + public function GetLastMessageID() { + return $this->lastMessageID; + } + /** * Check that a string looks roughly like an email address should * Static so it can be used without instantiation, public so people can overload @@ -1461,10 +1477,11 @@ class PHPMailer { } if($this->MessageID != '') { - $result .= $this->HeaderLine('Message-ID', $this->MessageID); + $this->lastMessageID = $this->MessageID; } else { - $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); + $this->lastMessageID = sprintf("<%s@%s>", $uniq_id, $this->ServerHostname()); } + $result .= $this->HeaderLine('Message-ID', $this->lastMessageID); $result .= $this->HeaderLine('X-Priority', $this->Priority); if ($this->XMailer == '') { $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (https://github.com/PHPMailer/PHPMailer/)');