Skip to content

Commit

Permalink
Merge changes from PHPMailer#101
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Aug 30, 2013
1 parent e16c820 commit 4075ba4
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions class.phpmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,13 @@ class PHPMailer
*/
protected $CustomHeader = array();

/**
* The most recent Message-ID (including angular brackets).
* @type string
* @access protected
*/
protected $lastMessageID = '';

/**
* The message's MIME type.
* @type string
Expand Down Expand Up @@ -806,6 +813,18 @@ public function setFrom($address, $name = '', $auto = true)
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 like an email address.
* @param string $address The email address to check
Expand Down Expand Up @@ -1606,10 +1625,11 @@ public function createHeader()
}

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(
Expand Down Expand Up @@ -2914,7 +2934,7 @@ public static function _mime_types($ext = '')
'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie'
);
return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
return (array_key_exists(strtolower($ext), $mimes) ? $mimes[strtolower($ext)]: 'application/octet-stream');
}

/**
Expand Down

0 comments on commit 4075ba4

Please sign in to comment.