From 230e369b3042d5ec507659b128ccdf2cb90d737a Mon Sep 17 00:00:00 2001 From: Synchro Date: Thu, 21 Mar 2013 11:10:52 +0100 Subject: [PATCH] Add unit test for EncodeQ [via SourceForge](https://sourceforge.net/p/phpmailer/bugs/341/) Minor PHPDoc cleanup --- class.phpmailer.php | 10 +++++----- test/phpmailerTest.php | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/class.phpmailer.php b/class.phpmailer.php index 3679023e..49d544e3 100644 --- a/class.phpmailer.php +++ b/class.phpmailer.php @@ -2567,8 +2567,8 @@ class PHPMailer { * $page->set('X-Priority', '3'); * * @access public - * @param string $name Parameter Name - * @param mixed $value Parameter Value + * @param string $name + * @param mixed $value * NOTE: will not work with arrays, there are no arrays to set/reset * @throws phpmailerException * @return bool @@ -2593,7 +2593,7 @@ class PHPMailer { /** * Strips newlines to prevent header injection. * @access public - * @param string $str String + * @param string $str * @return string */ public function SecureHeader($str) { @@ -2604,8 +2604,8 @@ class PHPMailer { * Set the private key file and password to sign the message. * * @access public - * @param $cert_filename - * @param string $key_filename Parameter File Name + * @param string $cert_filename + * @param string $key_filename * @param string $key_pass Password for private key */ public function Sign($cert_filename, $key_filename, $key_pass) { diff --git a/test/phpmailerTest.php b/test/phpmailerTest.php index 3c6b35e7..e47d0bd8 100644 --- a/test/phpmailerTest.php +++ b/test/phpmailerTest.php @@ -1025,6 +1025,21 @@ EOT; $this->Mail->ClearReplyTos(); } + /** + * Test address escaping + */ + function test_AddressEscaping() + { + $this->Mail->Subject .= ': Address escaping'; + $this->Mail->ClearAddresses(); + $this->Mail->AddAddress('foo@example.com', 'Tim "The Book" O\'Reilly'); + $this->Mail->Body = 'Test correct escaping of quotes in addresses.'; + $this->BuildBody(); + $this->Mail->PreSend(); + $b = $this->Mail->GetSentMIMEMessage(); + $this->assertTrue((strpos($b, 'To: "Tim \"The Book\" O\'Reilly" ') !==false)); + } + /** * Test BCC-only addressing */