mirror of
https://github.com/PHPMailer/PHPMailer.git
synced 2024-09-20 10:02:14 +02:00
Merge pull request #101 from davidsickmiller/patch-1
Added a function, GetLastMessageID, for accessing the last message ID
This commit is contained in:
commit
86ef725e80
@ -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/)');
|
||||
|
Loading…
Reference in New Issue
Block a user