diff --git a/.gitignore b/.gitignore index e1294abd..1006c116 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ docs/phpdoc/ test/message.txt test/testbootstrap.php test/*.pem -.idea build/ vendor/ diff --git a/VERSION b/VERSION index c95ed737..56f1219b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.2.15 \ No newline at end of file +5.2.16 \ No newline at end of file diff --git a/changelog.md b/changelog.md index e871ab2d..39b7c5a8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # ChangeLog +## Version 5.2.16 (June 6th 2016) +* Added DKIM example +* Fixed empty additional_parameters problem +* Fixed wrong version number in VERSION file! +* Improve line-length tests +* Use instance settings for SMTP::connect by default +* Use more secure auth mechanisms first + ## Version 5.2.15 (May 10th 2016) * Added ability to inject custom address validators, and set the default validator * Fix TLS 1.2 compatibility diff --git a/class.phpmailer.php b/class.phpmailer.php index 14842160..f9013ebb 100644 --- a/class.phpmailer.php +++ b/class.phpmailer.php @@ -31,7 +31,7 @@ class PHPMailer * The PHPMailer Version number. * @var string */ - public $Version = '5.2.15'; + public $Version = '5.2.16'; /** * Email priority. @@ -395,7 +395,7 @@ class PHPMailer /** * 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 */ public $DKIM_identity = ''; @@ -681,7 +681,9 @@ class PHPMailer } else { $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); } else { $result = @mail($to, $subject, $body, $header, $params); @@ -1425,9 +1427,9 @@ class PHPMailer } $to = implode(', ', $toArr); - if (empty($this->Sender)) { - $params = ' '; - } else { + $params = null; + //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver + if (!empty($this->Sender)) { $params = sprintf('-f%s', $this->Sender); } if ($this->Sender != '' and !ini_get('safe_mode')) { @@ -1435,7 +1437,7 @@ class PHPMailer ini_set('sendmail_from', $this->Sender); } $result = false; - if ($this->SingleTo && count($toArr) > 1) { + if ($this->SingleTo and count($toArr) > 1) { foreach ($toArr as $toAddr) { $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From); diff --git a/class.pop3.php b/class.pop3.php index 9b68bfa6..56ad1bfc 100644 --- a/class.pop3.php +++ b/class.pop3.php @@ -34,7 +34,7 @@ class POP3 * @var string * @access public */ - public $Version = '5.2.15'; + public $Version = '5.2.16'; /** * Default POP3 port number. diff --git a/class.smtp.php b/class.smtp.php index d5e9e0fa..0c016f12 100644 --- a/class.smtp.php +++ b/class.smtp.php @@ -30,7 +30,7 @@ class SMTP * The PHPMailer SMTP version number. * @var string */ - const VERSION = '5.2.15'; + const VERSION = '5.2.16'; /** * SMTP line break constant. @@ -81,7 +81,7 @@ class SMTP * @deprecated Use the `VERSION` constant instead * @see SMTP::VERSION */ - public $Version = '5.2.15'; + public $Version = '5.2.16'; /** * SMTP server port number. diff --git a/examples/DKIM.phps b/examples/DKIM.phps new file mode 100644 index 00000000..e3d2bae0 --- /dev/null +++ b/examples/DKIM.phps @@ -0,0 +1,38 @@ +setFrom('from@example.com', 'First Last'); +//Set an alternative reply-to address +$mail->addReplyTo('replyto@example.com', 'First Last'); +//Set who the message is to be sent to +$mail->addAddress('whoto@example.com', 'John Doe'); +//Set the subject line +$mail->Subject = 'PHPMailer DKIM test'; +//This should be the same as the domain of your From address +$mail->DKIM_domain = 'example.com'; +//Path to your private key file +$mail->DKIM_private = 'dkim_private.pem'; +//Set this to your own selector +$mail->DKIM_selector = 'phpmailer'; +//If your private key has a passphrase, set it here +$mail->DKIM_passphrase = ''; +//The identity you're signing as - usually your From address +$mail->DKIM_identity = $mail->From; + +//send the message, check for errors +if (!$mail->send()) { + echo "Mailer Error: " . $mail->ErrorInfo; +} else { + echo "Message sent!"; +}