Update phpMailer to version 5.2.16

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-08-02 08:50:22 +02:00
parent cc372ba89b
commit ceaa0fcf5c
2 changed files with 30 additions and 20 deletions

View File

@@ -31,7 +31,7 @@ class PHPMailer
* The PHPMailer Version number. * The PHPMailer Version number.
* @var string * @var string
*/ */
public $Version = '5.2.15'; public $Version = '5.2.16';
/** /**
* Email priority. * Email priority.
@@ -285,7 +285,7 @@ class PHPMailer
/** /**
* SMTP auth type. * SMTP auth type.
* Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5 * Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified
* @var string * @var string
*/ */
public $AuthType = ''; public $AuthType = '';
@@ -395,7 +395,7 @@ class PHPMailer
/** /**
* DKIM Identity. * DKIM Identity.
* Usually the email address used as the source of the email * Usually the email address used as the source of the email.
* @var string * @var string
*/ */
public $DKIM_identity = ''; public $DKIM_identity = '';
@@ -681,7 +681,9 @@ class PHPMailer
} else { } else {
$subject = $this->encodeHeader($this->secureHeader($subject)); $subject = $this->encodeHeader($this->secureHeader($subject));
} }
if (ini_get('safe_mode') || !($this->UseSendmailOptions)) { //Can't use additional_parameters in safe_mode
//@link http://php.net/manual/en/function.mail.php
if (ini_get('safe_mode') or !$this->UseSendmailOptions) {
$result = @mail($to, $subject, $body, $header); $result = @mail($to, $subject, $body, $header);
} else { } else {
$result = @mail($to, $subject, $body, $header, $params); $result = @mail($to, $subject, $body, $header, $params);
@@ -1425,9 +1427,9 @@ class PHPMailer
} }
$to = implode(', ', $toArr); $to = implode(', ', $toArr);
if (empty($this->Sender)) { $params = null;
$params = ' '; //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
} else { if (!empty($this->Sender)) {
$params = sprintf('-f%s', $this->Sender); $params = sprintf('-f%s', $this->Sender);
} }
if ($this->Sender != '' and !ini_get('safe_mode')) { if ($this->Sender != '' and !ini_get('safe_mode')) {
@@ -1435,7 +1437,7 @@ class PHPMailer
ini_set('sendmail_from', $this->Sender); ini_set('sendmail_from', $this->Sender);
} }
$result = false; $result = false;
if ($this->SingleTo && count($toArr) > 1) { if ($this->SingleTo and count($toArr) > 1) {
foreach ($toArr as $toAddr) { foreach ($toArr as $toAddr) {
$result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
$this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From); $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
@@ -1541,12 +1543,17 @@ class PHPMailer
* @throws phpmailerException * @throws phpmailerException
* @return boolean * @return boolean
*/ */
public function smtpConnect($options = array()) public function smtpConnect($options = null)
{ {
if (is_null($this->smtp)) { if (is_null($this->smtp)) {
$this->smtp = $this->getSMTPInstance(); $this->smtp = $this->getSMTPInstance();
} }
//If no options are provided, use whatever is set in the instance
if (is_null($options)) {
$options = $this->SMTPOptions;
}
// Already connected? // Already connected?
if ($this->smtp->connected()) { if ($this->smtp->connected()) {
return true; return true;
@@ -1616,7 +1623,7 @@ class PHPMailer
if (!$this->smtp->startTLS()) { if (!$this->smtp->startTLS()) {
throw new phpmailerException($this->lang('connect_host')); throw new phpmailerException($this->lang('connect_host'));
} }
// We must resend HELO after tls negotiation // We must resend EHLO after TLS negotiation
$this->smtp->hello($hello); $this->smtp->hello($hello);
} }
if ($this->SMTPAuth) { if ($this->SMTPAuth) {
@@ -2125,12 +2132,12 @@ class PHPMailer
//Can we do a 7-bit downgrade? //Can we do a 7-bit downgrade?
if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) { if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
$bodyEncoding = '7bit'; $bodyEncoding = '7bit';
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
$bodyCharSet = 'us-ascii'; $bodyCharSet = 'us-ascii';
} }
//If lines are too long, and we're not already using an encoding that will shorten them, //If lines are too long, and we're not already using an encoding that will shorten them,
//change to quoted-printable transfer encoding //change to quoted-printable transfer encoding for the body part only
if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) { if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) {
$this->Encoding = 'quoted-printable';
$bodyEncoding = 'quoted-printable'; $bodyEncoding = 'quoted-printable';
} }
@@ -2139,10 +2146,11 @@ class PHPMailer
//Can we do a 7-bit downgrade? //Can we do a 7-bit downgrade?
if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) { if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
$altBodyEncoding = '7bit'; $altBodyEncoding = '7bit';
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
$altBodyCharSet = 'us-ascii'; $altBodyCharSet = 'us-ascii';
} }
//If lines are too long, and we're not already using an encoding that will shorten them, //If lines are too long, and we're not already using an encoding that will shorten them,
//change to quoted-printable transfer encoding //change to quoted-printable transfer encoding for the alt body part only
if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) { if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) {
$altBodyEncoding = 'quoted-printable'; $altBodyEncoding = 'quoted-printable';
} }
@@ -2246,8 +2254,10 @@ class PHPMailer
$body .= $this->attachAll('attachment', $this->boundary[1]); $body .= $this->attachAll('attachment', $this->boundary[1]);
break; break;
default: default:
// catch case 'plain' and case '' // Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types
$body .= $this->encodeString($this->Body, $bodyEncoding); //Reset the `Encoding` property in case we changed it for line length reasons
$this->Encoding = $bodyEncoding;
$body .= $this->encodeString($this->Body, $this->Encoding);
break; break;
} }
@@ -2353,8 +2363,7 @@ class PHPMailer
/** /**
* Set the message type. * Set the message type.
* PHPMailer only supports some preset message types, * PHPMailer only supports some preset message types, not arbitrary MIME structures.
* not arbitrary MIME structures.
* @access protected * @access protected
* @return void * @return void
*/ */
@@ -2372,6 +2381,7 @@ class PHPMailer
} }
$this->message_type = implode('_', $type); $this->message_type = implode('_', $type);
if ($this->message_type == '') { if ($this->message_type == '') {
//The 'plain' message_type refers to the message having a single body element, not that it is plain-text
$this->message_type = 'plain'; $this->message_type = 'plain';
} }
} }

View File

@@ -30,7 +30,7 @@ class SMTP
* The PHPMailer SMTP version number. * The PHPMailer SMTP version number.
* @var string * @var string
*/ */
const VERSION = '5.2.15'; const VERSION = '5.2.16';
/** /**
* SMTP line break constant. * SMTP line break constant.
@@ -81,7 +81,7 @@ class SMTP
* @deprecated Use the `VERSION` constant instead * @deprecated Use the `VERSION` constant instead
* @see SMTP::VERSION * @see SMTP::VERSION
*/ */
public $Version = '5.2.15'; public $Version = '5.2.16';
/** /**
* SMTP server port number. * SMTP server port number.
@@ -400,7 +400,7 @@ class SMTP
); );
if (empty($authtype)) { if (empty($authtype)) {
foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN', 'XOAUTH2') as $method) { foreach (array('CRAM-MD5', 'LOGIN', 'PLAIN', 'NTLM', 'XOAUTH2') as $method) {
if (in_array($method, $this->server_caps['AUTH'])) { if (in_array($method, $this->server_caps['AUTH'])) {
$authtype = $method; $authtype = $method;
break; break;