Skip to content

Commit

Permalink
Merge in changes from Google code 5.2.4 release
Browse files Browse the repository at this point in the history
Code cleanup in SMTP class
  • Loading branch information
Synchro committed Feb 21, 2013
1 parent a51a9e1 commit adb0197
Show file tree
Hide file tree
Showing 9 changed files with 286 additions and 275 deletions.
23 changes: 19 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
# ChangeLog

* Add CRAM-MD5 authentication, thanks to Elijah madden, https://github.com/okonomiyaki3000
* Replacement of obsolete Quoted-Printable encoder with a much better implementation
* Composer package definition

* Merge in changes from Google code 5.2.4 release
* Minor coding standards cleanup in SMTP class
* Improved unit tests, now tests S/MIME signing
* Travis-CI support on GitHub, runs tests with fake SMTP server

## Version 5.2.4 (February 19, 2013)
* Fix tag and version bug.
* un-deprecate isSMTP(), isMail(), IsSendmail() and
isQmail().
* Numerous translation updates

## Version 5.2.3 (February 8, 2013)
* Fix issue with older PCREs and ValidateAddress() (Bugz: 124)

* Add CRAM-MD5 authentication, thanks to Elijah madden, https://github.com/okonomiyaki3000
* Replacement of obsolete Quoted-Printable encoder with a much better implementation
* Composer package definition
* New language added: Hebrew

## Version 5.2.2 (December 3, 2012)

Expand Down
66 changes: 31 additions & 35 deletions class.phpmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*~ class.phpmailer.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
| Version: 5.2.2 |
| Version: 5.2.4 |
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
| ------------------------------------------------------------------------- |
| Admin: Jim Jagielski (project admininistrator) |
Expand Down Expand Up @@ -103,7 +103,7 @@ class PHPMailer {
*/
public $ReturnPath = '';

/**
/**
* Sets the Subject of the message.
* @var string
*/
Expand Down Expand Up @@ -390,7 +390,7 @@ class PHPMailer {
* Sets the PHPMailer Version number
* @var string
*/
public $Version = '5.2.2';
public $Version = '5.2.4';

/**
* What to use in the X-Mailer header
Expand Down Expand Up @@ -554,7 +554,6 @@ public function IsHTML($ishtml = true) {
/**
* Sets Mailer to send message using SMTP.
* @return void
* @deprecated
*/
public function IsSMTP() {
$this->Mailer = 'smtp';
Expand All @@ -563,7 +562,6 @@ public function IsSMTP() {
/**
* Sets Mailer to send message using PHP mail() function.
* @return void
* @deprecated
*/
public function IsMail() {
$this->Mailer = 'mail';
Expand All @@ -572,7 +570,6 @@ public function IsMail() {
/**
* Sets Mailer to send message using the $Sendmail program.
* @return void
* @deprecated
*/
public function IsSendmail() {
if (!stristr(ini_get('sendmail_path'), 'sendmail')) {
Expand All @@ -584,7 +581,6 @@ public function IsSendmail() {
/**
* Sets Mailer to send message using the qmail MTA.
* @return void
* @deprecated
*/
public function IsQmail() {
if (stristr(ini_get('sendmail_path'), 'qmail')) {
Expand Down Expand Up @@ -736,7 +732,7 @@ public function SetFrom($address, $name = '', $auto = 1) {
*/
public static function ValidateAddress($address) {
if (defined('PCRE_VERSION')) { //Check this instead of extension_loaded so it works when that function is disabled
if (PCRE_VERSION >= 8.0) {
if (version_compare(PCRE_VERSION, '8.0') >= 0) {
return (boolean)preg_match('/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', $address);
} else {
//Fall back to an older regex that doesn't need a recent PCRE
Expand Down Expand Up @@ -910,14 +906,14 @@ protected function SendmailSend($header, $body) {
return true;
}

/**
* Sends mail using the PHP mail() function.
* @param string $header The message headers
* @param string $body The message body
* @throws phpmailerException
* @access protected
* @return bool
*/
/**
* Sends mail using the PHP mail() function.
* @param string $header The message headers
* @param string $body The message body
* @throws phpmailerException
* @access protected
* @return bool
*/
protected function MailSend($header, $body) {
$toArr = array();
foreach($this->to as $t) {
Expand Down Expand Up @@ -2031,13 +2027,13 @@ public function Base64EncodeWrapMB($str, $lf=null) {
}

/**
* Encode string to RFC2045 (6.7) quoted-printable format
* @access public
* @param string $string The text to encode
* @param integer $line_max Number of chars allowed on a line before wrapping
* @return string
* @link PHP version adapted from http:https://www.php.net/manual/en/function.quoted-printable-decode.php#89417
*/
* Encode string to RFC2045 (6.7) quoted-printable format
* @access public
* @param string $string The text to encode
* @param integer $line_max Number of chars allowed on a line before wrapping
* @return string
* @link PHP version adapted from http:https://www.php.net/manual/en/function.quoted-printable-decode.php#89417
*/
public function EncodeQP($string, $line_max = 76) {
if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3)
return quoted_printable_encode($string);
Expand All @@ -2048,15 +2044,15 @@ public function EncodeQP($string, $line_max = 76) {
return $string;
}

/**
* Wrapper to preserve BC for old QP encoding function that was removed
* @see EncodeQP()
* @access public
* @param string $string
* @param integer $line_max
* @param bool $space_conv
* @return string
*/
/**
* Wrapper to preserve BC for old QP encoding function that was removed
* @see EncodeQP()
* @access public
* @param string $string
* @param integer $line_max
* @param bool $space_conv
* @return string
*/
public function EncodeQPphp($string, $line_max = 76, $space_conv = false) {
return $this->EncodeQP($string, $line_max);
}
Expand Down Expand Up @@ -2179,12 +2175,12 @@ public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64',
* @param string $type MIME type.
* @return bool True on successfully adding an attachment
*/
public function AddStringEmbeddedImage($string, $cid, $filename = '', $encoding = 'base64', $type = 'application/octet-stream') {
public function AddStringEmbeddedImage($string, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
// Append to $attachment array
$this->attachment[] = array(
0 => $string,
1 => $filename,
2 => basename($filename),
1 => $name,
2 => $name,
3 => $encoding,
4 => $type,
5 => true, // isStringAttachment
Expand Down
6 changes: 3 additions & 3 deletions class.pop3.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*~ class.pop3.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
| Version: 5.2.2 |
| Version: 5.2.4 |
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
| ------------------------------------------------------------------------- |
| Admin: Jim Jagielski (project admininistrator) |
Expand Down Expand Up @@ -37,7 +37,7 @@
/**
* PHP POP-Before-SMTP Authentication Class
*
* Version 5.2.2
* Version 5.2.4
*
* @license: LGPL, see PHPMailer License
*
Expand Down Expand Up @@ -115,7 +115,7 @@ class POP3 {
* Sets the POP3 PHPMailer Version number
* @var string
*/
public $Version = '5.2.2';
public $Version = '5.2.4';

/////////////////////////////////////////////////
// PROPERTIES, PRIVATE AND PROTECTED
Expand Down
Loading

0 comments on commit adb0197

Please sign in to comment.