diff --git a/changelog.md b/changelog.md index c546404f..1c9e9765 100644 --- a/changelog.md +++ b/changelog.md @@ -47,9 +47,12 @@ This is a major update that breaks backwards compatibility. * To reduce code footprint, the examples folder is no longer included in composer deployments or github zip files * Trap low-level errors in SMTP, reports via debug output +* Handle bare codes (an RFC contravention) in SMTP server responses +* Make message timestamps more dynamic - calculate the date separately for each message + ## Version 5.2.23 (March 15th 2017) * Improve trapping of TLS errors during connection so that they don't cause warnings, and are reported better in debug output -* Amend test suite so it uses PHPUnit version 4.8, compatible with older versions of PHP, instead of teh version supplied by Travis-CI +* Amend test suite so it uses PHPUnit version 4.8, compatible with older versions of PHP, instead of the version supplied by Travis-CI * This forces pinning of some dev packages to older releases, but should make travis builds more reliable * Test suite now runs on HHVM, and thus so should PHPMailer in general * Improve Czech translations diff --git a/examples/gmail_xoauth.phps b/examples/gmail_xoauth.phps index 252f4fee..850f2604 100644 --- a/examples/gmail_xoauth.phps +++ b/examples/gmail_xoauth.phps @@ -46,6 +46,7 @@ $mail->SMTPAuth = true; $mail->AuthType = 'XOAUTH2'; //Fill in authentication details here +//Either the gmail account owner, or the user that gave consent $email = 'someone@gmail.com'; $clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com'; $clientSecret = 'RANDOMCHARS-----lGyjPcRtvP'; diff --git a/src/PHPMailer.php b/src/PHPMailer.php index 057a8d0f..1146c5a7 100644 --- a/src/PHPMailer.php +++ b/src/PHPMailer.php @@ -2096,10 +2096,7 @@ class PHPMailer { $result = ''; - if ('' == $this->MessageDate) { - $this->MessageDate = static::rfcDate(); - } - $result .= $this->headerLine('Date', $this->MessageDate); + $result .= $this->headerLine('Date', $this->MessageDate == '' ? self::rfcDate() : $this->MessageDate); // To be created automatically by mail() if ($this->SingleTo) { diff --git a/src/SMTP.php b/src/SMTP.php index 3fab4f0d..eb9b1165 100644 --- a/src/SMTP.php +++ b/src/SMTP.php @@ -1064,8 +1064,10 @@ class SMTP $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL); $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL); $data .= $str; - // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen - if ((isset($str[3]) and $str[3] == ' ')) { + // If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled), + // or 4th character is a space, we are done reading, break the loop, + // string array access is a micro-optimisation over strlen + if (!isset($str[3]) or (isset($str[3]) and $str[3] == ' ')) { break; } // Timed-out? Log and break