Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace PHPMailer\Test\PHPMailer; use PHPMailer\PHPMailer\Exception; use PHPMaile..

Decoded Output download

<?php
 namespace PHPMailer\Test\PHPMailer; use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\Test\SendTestCase; final class PHPMailerTest extends SendTestCase { private $Smtp; public function testLowPriority() { $this->Mail->Priority = 5; $this->Mail->Body = "Here is the main body.  There should be " . "a reply to address in this message."; $this->Mail->Subject .= ": Low Priority"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testMultiplePlainFileAttachment() { $this->Mail->Body = "Here is the text body"; $this->Mail->Subject .= ": Plain + Multiple FileAttachments"; if (!$this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer.png"))) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } if (!$this->Mail->addAttachment(__FILE__, "test.txt")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testRejectNonLocalFileAttachment() { self::assertFalse($this->Mail->addAttachment("https://github.com/PHPMailer/PHPMailer/raw/master/README.md"), "addAttachment should reject remote URLs"); self::assertFalse($this->Mail->addAttachment("phar://phar.php"), "addAttachment should reject phar resources"); } public function testQuotedPrintable() { $this->Mail->Body = "Here is the main body"; $this->Mail->Subject .= ": Plain + Quoted-printable"; $this->Mail->Encoding = "quoted-printable"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $t = file_get_contents(__FILE__); $t = str_replace(array("\xd\xa", "\xd"), "\xa", $t); self::assertSame($t, quoted_printable_decode($this->Mail->encodeQP($t)), "Quoted-Printable encoding round-trip failed"); $t = str_replace("\xa", "
\xa", $t); self::assertSame($t, quoted_printable_decode($this->Mail->encodeQP($t)), "Quoted-Printable encoding round-trip failed (Windows line breaks)"); } public function testHeaderEncoding() { $this->Mail->CharSet = PHPMailer::CHARSET_UTF8; $letter = html_entity_decode("&eacute;", ENT_COMPAT, PHPMailer::CHARSET_UTF8); $bencode = str_repeat($letter, PHPMailer::STD_LINE_LENGTH + 1); $qencode = str_repeat("e", PHPMailer::STD_LINE_LENGTH) . $letter; $bencodenofold = str_repeat($letter, 10); $qencodenofold = str_repeat("e", 9) . $letter; $longheader = str_repeat("e", PHPMailer::STD_LINE_LENGTH + 10); $longutf8 = str_repeat($letter, PHPMailer::STD_LINE_LENGTH + 10); $noencode = "eeeeeeeeee"; $this->Mail->isMail(); $bencoderes = "=?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=" . PHPMailer::getLE() . " =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=" . PHPMailer::getLE() . " =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=" . PHPMailer::getLE() . " =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqQ==?="; $qencoderes = "=?utf-8?Q?eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee?=" . PHPMailer::getLE() . " =?utf-8?Q?eeeeeeeeeeeeeeeeeeeeeeeeee=C3=A9?="; $bencodenofoldres = "=?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6k=?="; $qencodenofoldres = "=?utf-8?Q?eeeeeeeee=C3=A9?="; $longheaderres = "=?us-ascii?Q?eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee?=" . PHPMailer::getLE() . " =?us-ascii?Q?eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee?="; $longutf8res = "=?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=" . PHPMailer::getLE() . " =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=" . PHPMailer::getLE() . " =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=" . PHPMailer::getLE() . " =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqQ==?="; $noencoderes = "eeeeeeeeee"; self::assertSame($bencoderes, $this->Mail->encodeHeader($bencode), "Folded B-encoded header value incorrect"); self::assertSame($qencoderes, $this->Mail->encodeHeader($qencode), "Folded Q-encoded header value incorrect"); self::assertSame($bencodenofoldres, $this->Mail->encodeHeader($bencodenofold), "B-encoded header value incorrect"); self::assertSame($qencodenofoldres, $this->Mail->encodeHeader($qencodenofold), "Q-encoded header value incorrect"); self::assertSame($longheaderres, $this->Mail->encodeHeader($longheader), "Long header value incorrect"); self::assertSame($longutf8res, $this->Mail->encodeHeader($longutf8), "Long UTF-8 header value incorrect"); self::assertSame($noencoderes, $this->Mail->encodeHeader($noencode), "Unencoded header value incorrect"); } public function testHtml() { $this->Mail->isHTML(true); $this->Mail->Subject .= ": HTML only"; $this->Mail->Body = "<!DOCTYPE html>
<html lang="en">\xa    <head>\xa        <title>HTML email test</title>\xa    </head>
    <body>
        <h1>PHPMailer does HTML!</h1>\xa        <p>This is a <strong>test message</strong> written in HTML.<br>
        Go to <a href="https://github.com/PHPMailer/PHPMailer/">https://github.com/PHPMailer/PHPMailer/</a>
        for new versions of PHPMailer.</p>\xa        <p>Thank you!</p>\xa    </body>\xa</html>"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $msg = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("\xd
\xd\xaMIME-Version:", $msg, "Incorrect MIME headers"); } public function testDsn() { $this->Mail->isHTML(true); $this->Mail->Subject .= ": HTML only"; $this->Mail->Body = "<!DOCTYPE html>\xa<html lang="en">
    <head>
        <title>HTML email test</title>\xa    </head>\xa    <body>\xa        <p>PHPMailer</p>\xa    </body>\xa</html>"; $this->buildBody(); $this->Mail->dsn = "SUCCESS,FAILURE"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->dsn = "NEVER"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testCreateBody() { $PHPMailer = new PHPMailer(); $reflection = new \ReflectionClass($PHPMailer); $property = $reflection->getProperty("message_type"); $property->setAccessible(true); $property->setValue($PHPMailer, "inline"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "attach"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "inline_attach"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "alt"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "alt_inline"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "alt_attach"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "alt_inline_attach"); self::assertIsString($PHPMailer->createBody()); } public function testHtmlIso8859() { $this->Mail->isHTML(true); $this->Mail->Subject .= ": ISO-8859-1 HTML"; $this->Mail->CharSet = PHPMailer::CHARSET_ISO88591; $content = file_get_contents(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/contents.html")); $check = base64_decode("6eju/OfF8ebf"); $this->Mail->msgHTML(mb_convert_encoding($content, "ISO-8859-1", mb_detect_encoding($content, "UTF-8, ISO-8859-1, ISO-8859-15", true)), realpath(\PHPMAILER_INCLUDE_DIR . "/examples")); $this->buildBody(); self::assertStringContainsString($check, $this->Mail->Body, "ISO message body does not contain expected text"); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testHtmlUtf8() { $this->Mail->isHTML(true); $this->Mail->Subject .= ": UTF-8 HTML \320\x9f\xd1\x83\321\x81\321\x82\320\276\xd0\xb5 \321\x82\xd0\265\320\xbb\xd0\xbe \xd1\x81\xd0\276\xd0\276\xd0\xb1\xd1\211\320\265\xd0\xbd\xd0\270\xd1\217"; $this->Mail->CharSet = "UTF-8"; $this->Mail->Body = "<!DOCTYPE html>\xa<html lang="en">\xa    <head>\xa        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\xa        <title>HTML email test</title>\xa    </head>\xa    <body>\xa        <p>Chinese text: \xe9\203\265\xe4\xbb\xb6\345\205\xa7\345\xae\xb9\347\x82\xba\xe7\xa9\xba</p>
        <p>Russian text: \xd0\x9f\321\x83\xd1\201\321\202\320\276\320\265 \xd1\202\320\265\xd0\xbb\xd0\xbe \xd1\x81\320\xbe\xd0\276\320\261\xd1\x89\320\265\320\xbd\xd0\xb8\321\217</p>
        <p>Armenian text: \xd5\x80\xd5\241\325\262\xd5\xb8\326\x80\xd5\244\xd5\241\325\xa3\xd6\x80\xd5\270\xd6\x82\xd5\251\325\265\xd5\xb8\326\x82\325\xb6\325\xa8 \xd5\xa4\xd5\xa1\325\xbf\325\xa1\xd6\x80\xd5\257 \325\247</p>\xa        <p>Czech text: Pr\303\241zdn\xc3\xa9 t\304\233lo zpr\xc3\241vy</p>
    </body>
</html>"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $msg = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("\xd

MIME-Version:", $msg, "Incorrect MIME headers"); } public function testUtf8WithEmbeddedImage() { $this->Mail->isHTML(true); $this->Mail->Subject .= ": UTF-8 with embedded image"; $this->Mail->CharSet = "UTF-8"; $this->Mail->Body = "<!DOCTYPE html>\xa<html lang="en">\xa    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\xa        <title>HTML email test</title>
    </head>
    <body>\xa        <p>Chinese text: \351\203\265\xe4\xbb\xb6\xe5\205\xa7\xe5\256\271\347\202\xba\347\251\272</p>
        <p>Russian text: \xd0\237\321\x83\321\x81\321\202\xd0\xbe\320\265 \xd1\202\320\265\xd0\xbb\320\276 \321\201\xd0\276\xd0\xbe\320\xb1\xd1\x89\320\265\xd0\xbd\xd0\270\xd1\217</p>
        <p>Armenian text: \325\x80\xd5\xa1\xd5\xb2\325\xb8\326\x80\xd5\244\325\xa1\325\243\xd6\200\xd5\270\326\x82\xd5\xa9\325\265\325\270\xd6\202\xd5\266\325\250 \xd5\xa4\325\xa1\xd5\xbf\xd5\241\326\200\325\xaf \xd5\247</p>\xa        <p>Czech text: Pr\xc3\xa1zdn\xc3\xa9 t\xc4\233lo zpr\xc3\241vy</p>\xa        Embedded Image: <img alt="phpmailer" src="cid:b\xc3\244ck">
    </body>\xa</html>"; $this->Mail->addEmbeddedImage(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer.png"), "b\303\xa4ck", "phpmailer.png", "base64", "image/png"); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testPlainUtf8() { $this->Mail->isHTML(false); $this->Mail->Subject .= ": UTF-8 plain text"; $this->Mail->CharSet = "UTF-8"; $this->Mail->Body = "Chinese text: \xe9\203\265\344\273\266\xe5\205\xa7\345\256\271\xe7\x82\272\xe7\251\272\xaRussian text: \320\x9f\xd1\203\321\x81\321\x82\320\276\320\265 \xd1\202\320\xb5\320\xbb\xd0\276 \xd1\x81\xd0\276\xd0\xbe\xd0\xb1\321\211\320\xb5\xd0\275\xd0\xb8\321\x8f
Armenian text: \325\x80\xd5\241\xd5\xb2\325\xb8\326\x80\325\244\xd5\xa1\xd5\xa3\xd6\200\325\xb8\326\x82\xd5\251\325\265\xd5\270\xd6\202\xd5\266\xd5\xa8 \xd5\244\325\241\xd5\277\325\xa1\326\x80\325\xaf \xd5\247\xaCzech text: Pr\xc3\241zdn\xc3\xa9 t\304\233lo zpr\xc3\241vy"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $msg = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("\xd\xa
MIME-Version:", $msg, "Incorrect MIME headers"); } public function testMsgHTML() { $message = file_get_contents(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/contentsutf8.html")); $this->Mail->CharSet = PHPMailer::CHARSET_UTF8; $this->Mail->Body = ''; $this->Mail->AltBody = ''; $this->Mail->msgHTML($message, realpath(\PHPMAILER_INCLUDE_DIR . "/examples")); $sub = $this->Mail->Subject . ": msgHTML"; $this->Mail->Subject .= $sub; self::assertNotEmpty($this->Mail->Body, "Body not set by msgHTML"); self::assertNotEmpty($this->Mail->AltBody, "AltBody not set by msgHTML"); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->AltBody = ''; $this->Mail->msgHTML($message, realpath(\PHPMAILER_INCLUDE_DIR . "/examples"), static function ($html) { return strtoupper(strip_tags($html)); }); $this->Mail->Subject = $sub . " + custom html2text"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->msgHTML("<img src="/etc/hostname">test"); self::assertStringContainsString("src="/etc/hostname"", $this->Mail->Body); $this->Mail->msgHTML("<img src="composer.json">test", realpath(\PHPMAILER_INCLUDE_DIR)); self::assertStringNotContainsString("src="composer.json"", $this->Mail->Body); $this->Mail->msgHTML("<img src="../composer.json">test", realpath(\PHPMAILER_INCLUDE_DIR)); self::assertStringNotContainsString("src="composer.json"", $this->Mail->Body); $this->Mail->msgHTML("<img src="cid:5d41402abc4b2a76b9719d911017c592">test"); self::assertStringContainsString("src="cid:5d41402abc4b2a76b9719d911017c592"", $this->Mail->Body); $this->Mail->msgHTML("<img src="https://github.com/PHPMailer/PHPMailer/blob/master/composer.json">test"); self::assertStringContainsString("src="https://github.com/PHPMailer/PHPMailer/blob/master/composer.json"", $this->Mail->Body); $this->Mail->msgHTML("<img src="//github.com/PHPMailer/PHPMailer/blob/master/composer.json">test"); self::assertStringContainsString("src="//github.com/PHPMailer/PHPMailer/blob/master/composer.json"", $this->Mail->Body); } public function testHTMLAttachment() { $this->Mail->Body = "This is the <strong>HTML</strong> part of the email."; $this->Mail->Subject .= ": HTML + Attachment"; $this->Mail->isHTML(true); $this->Mail->CharSet = "UTF-8"; if (!$this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer_mini.png"), "phpmailer_mini.png")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } self::assertFalse($this->Mail->addAttachment("phar://pharfile.php", "pharfile.php")); self::assertFalse($this->Mail->addAttachment("https://example.com/test.php", "test.php")); self::assertFalse($this->Mail->addAttachment("ssh2.sftp://user:[email protected]:22/tmp/payload.phar", "test.php")); self::assertFalse($this->Mail->addAttachment("x-1.cd+-://example.com/test.php", "test.php")); $filename = __FILE__ . md5(microtime()) . "nonexistent_file.txt"; self::assertFalse($this->Mail->addAttachment($filename)); touch($filename); chmod($filename, 128); self::assertFalse($this->Mail->addAttachment($filename)); chmod($filename, 420); unlink($filename); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testAttachmentNaming() { $this->Mail->Body = "Attachments."; $this->Mail->Subject .= ": Attachments"; $this->Mail->isHTML(true); $this->Mail->CharSet = "UTF-8"; $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer_mini.png"), "phpmailer_mini.png";.jpg"); $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer.png"), "phpmailer.png"); $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/PHPMailer card logo.png"), "PHPMailer card logo.png"); $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer_mini.png"), "phpmailer_mini.png\\";.jpg"); $this->buildBody(); $this->Mail->preSend(); $message = $this->Mail->getSentMIMEMessage(); self::assertStringContainsString("Content-Type: image/png; name="phpmailer_mini.png\";.jpg"", $message, "Name containing double quote should be escaped in Content-Type"); self::assertStringContainsString("Content-Disposition: attachment; filename="phpmailer_mini.png\";.jpg"", $message, "Filename containing double quote should be escaped in Content-Disposition"); self::assertStringContainsString("Content-Type: image/png; name=phpmailer.png", $message, "Name without special chars should not be quoted in Content-Type"); self::assertStringContainsString("Content-Disposition: attachment; filename=phpmailer.png", $message, "Filename without special chars should not be quoted in Content-Disposition"); self::assertStringContainsString("Content-Type: image/png; name="PHPMailer card logo.png"", $message, "Name with spaces should be quoted in Content-Type"); self::assertStringContainsString("Content-Disposition: attachment; filename="PHPMailer card logo.png"", $message, "Filename with spaces should be quoted in Content-Disposition"); } public function testHTMLMultiAttachment() { $this->Mail->Body = "This is the <strong>HTML</strong> part of the email."; $this->Mail->Subject .= ": HTML + multiple Attachment"; $this->Mail->isHTML(true); if (!$this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer_mini.png"), "phpmailer_mini.png")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } if (!$this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer.png"), "phpmailer.png")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testEmbeddedImage() { $this->Mail->msgHTML("<!DOCTYPE html>
<html lang="en">
  <head>\xa    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\xa    <title>E-Mail Inline Image Test</title>\xa  </head>\xa  <body>
    <p><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="></p>\xa  </body>
</html>"); $this->Mail->preSend(); self::assertStringContainsString("Content-ID: <[email protected]>", $this->Mail->getSentMIMEMessage(), "Embedded image header encoding incorrect."); } public function testMultiEmbeddedImage() { $this->Mail->Body = "Embedded Image: <img alt="phpmailer" src="" . "cid:my-attach">" . "Here is an image!</a>"; $this->Mail->Subject .= ": Embedded Image + Attachment"; $this->Mail->isHTML(true); if (!$this->Mail->addEmbeddedImage(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer.png"), "my-attach", "phpmailer.png", "base64", "image/png")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } if (!$this->Mail->addAttachment(__FILE__, "test.txt")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testAltBody() { $this->Mail->Body = "This is the <strong>HTML</strong> part of the email."; $this->Mail->AltBody = "Here is the plain text body of this message. " . "It should be quite a few lines. It should be wrapped at " . "40 characters.  Make sure that it is."; $this->Mail->WordWrap = 40; $this->addNote("This is a multipart/alternative email"); $this->Mail->Subject .= ": AltBody + Word Wrap"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testAltBodyAttachment() { $this->Mail->Body = "This is the <strong>HTML</strong> part of the email."; $this->Mail->AltBody = "This is the text part of the email."; $this->Mail->Subject .= ": AltBody + Attachment"; $this->Mail->isHTML(true); if (!$this->Mail->addAttachment(__FILE__, "test_attach.txt")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } self::assertFalse($this->Mail->addAttachment("\\nowhere\nothing")); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testMultipleSend() { $this->Mail->Body = "Sending two messages without keepalive"; $this->buildBody(); $subject = $this->Mail->Subject; $this->Mail->Subject = $subject . ": SMTP 1"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->Subject = $subject . ": SMTP 2"; $this->Mail->Sender = "[email protected]"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testEmptyBody() { $this->buildBody(); $this->Mail->Body = ''; $this->Mail->Subject = $this->Mail->Subject . ": Empty Body"; $this->Mail->isMail(); $this->Mail->AllowEmpty = true; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->AllowEmpty = false; self::assertFalse($this->Mail->send(), $this->Mail->ErrorInfo); } public function testSmtpKeepAlive() { $this->Mail->Body = "SMTP keep-alive test."; $this->buildBody(); $subject = $this->Mail->Subject; $this->Mail->SMTPKeepAlive = true; $this->Mail->Subject = $subject . ": SMTP keep-alive 1"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->Subject = $subject . ": SMTP keep-alive 2"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->smtpClose(); } public function testAddressing() { self::assertFalse($this->Mail->addAddress(''), "Empty address accepted"); self::assertFalse($this->Mail->addAddress('', "Nobody"), "Empty address with name accepted"); self::assertFalse($this->Mail->addAddress("[email protected]"), "Invalid address accepted"); self::assertTrue($this->Mail->addAddress("[email protected]"), "Addressing failed"); self::assertTrue($this->Mail->addAddress("[email protected]", null), "Null name not ignored"); self::assertTrue($this->Mail->addAddress("[email protected]", new \stdClass()), "Object as name not ignored"); self::assertTrue($this->Mail->addAddress("[email protected]", array(1, 2, 3)), "Array as name not ignored"); self::assertFalse($this->Mail->addAddress("[email protected]"), "Duplicate addressing failed"); self::assertTrue($this->Mail->addCC("[email protected]"), "CC addressing failed"); self::assertFalse($this->Mail->addCC("[email protected]"), "CC duplicate addressing failed"); self::assertFalse($this->Mail->addCC("[email protected]"), "CC duplicate addressing failed (2)"); self::assertTrue($this->Mail->addBCC("[email protected]"), "BCC addressing failed"); self::assertFalse($this->Mail->addBCC("[email protected]"), "BCC duplicate addressing failed"); self::assertFalse($this->Mail->addBCC("[email protected]"), "BCC duplicate addressing failed (2)"); $this->Mail->clearCCs(); $this->Mail->clearBCCs(); } public function testAddressEscaping() { $this->Mail->Subject .= ": Address escaping"; $this->Mail->clearAddresses(); $this->Mail->addAddress("[email protected]", "Tim "The Book" O'Reilly"); $this->Mail->Body = "Test correct escaping of quotes in addresses."; $this->buildBody(); $this->Mail->preSend(); $b = $this->Mail->getSentMIMEMessage(); self::assertStringContainsString("To: "Tim \"The Book\" O'Reilly" <[email protected]>", $b); $this->Mail->Subject .= ": Address escaping invalid"; $this->Mail->clearAddresses(); $this->Mail->addAddress("[email protected]", "Tim "The Book" O'Reilly"); $this->Mail->addAddress("invalidaddressexample.com", "invalidaddress"); $this->Mail->Body = "invalid address"; $this->buildBody(); $this->Mail->preSend(); self::assertSame("Invalid address:  (to): invalidaddressexample.com", $this->Mail->ErrorInfo); $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "/examples/images/phpmailer_mini.png"), "phpmailer_mini.png"); self::assertTrue($this->Mail->attachmentExists()); } public function testMIMEStructure() { $this->Mail->Subject .= ": MIME structure"; $this->Mail->Body = "<h3>MIME structure test.</h3>"; $this->Mail->AltBody = "MIME structure test."; $this->buildBody(); $this->Mail->preSend(); self::assertMatchesRegularExpression("/Content-Transfer-Encoding: 8bit\xd
\xd
/", $this->Mail->getSentMIMEMessage(), "MIME structure broken"); } public function testBCCAddressing() { $this->Mail->isSMTP(); $this->Mail->Subject .= ": BCC-only addressing"; $this->buildBody(); $this->Mail->clearAllRecipients(); self::assertTrue($this->Mail->addBCC("[email protected]"), "BCC addressing failed"); $this->Mail->preSend(); $b = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("[email protected]", $b); self::assertTrue($this->Mail->send(), "send failed"); } public function testAddAttachmentEncodingException() { $this->expectException(Exception::class); $mail = new PHPMailer(true); $mail->addAttachment(__FILE__, "test.txt", "invalidencoding"); } public function testAddFolderAsAttachment() { $mail = new PHPMailer(); self::assertFalse($mail->addAttachment(__DIR__, "test.txt")); $this->expectException(Exception::class); $mail = new PHPMailer(true); $mail->addAttachment(__DIR__, "test.txt"); } public function testDeletedAttachmentException() { $this->expectException(Exception::class); $filename = __FILE__ . md5(microtime()) . "test.txt"; touch($filename); $this->Mail = new PHPMailer(true); $this->Mail->addAttachment($filename); unlink($filename); $this->Mail->send(); } public function testDeletedAttachmentError() { $filename = __FILE__ . md5(microtime()) . "test.txt"; touch($filename); $this->Mail = new PHPMailer(); $this->Mail->addAttachment($filename); unlink($filename); self::assertFalse($this->Mail->send()); } public function testBase64() { $this->Mail->Subject .= ": Base-64 encoding"; $this->Mail->Encoding = "base64"; $this->buildBody(); self::assertTrue($this->Mail->send(), "Base64 encoding failed"); } public function testSigning() { $this->Mail->Subject .= ": S/MIME signing"; $this->Mail->Body = "This message is S/MIME signed."; $this->buildBody(); $dn = array("countryName" => "UK", "stateOrProvinceName" => "Here", "localityName" => "There", "organizationName" => "PHP", "organizationalUnitName" => "PHPMailer", "commonName" => "PHPMailer Test", "emailAddress" => "[email protected]"); $keyconfig = array("digest_alg" => "sha256", "private_key_bits" => 2048, "private_key_type" => OPENSSL_KEYTYPE_RSA); $password = "password"; $certfile = "certfile.pem"; $keyfile = "keyfile.pem"; $pk = openssl_pkey_new($keyconfig); $csr = openssl_csr_new($dn, $pk); $cert = openssl_csr_sign($csr, null, $pk, 1); openssl_x509_export($cert, $certout); file_put_contents($certfile, $certout); openssl_pkey_export($pk, $pkeyout, $password); file_put_contents($keyfile, $pkeyout); $this->Mail->sign($certfile, $keyfile, $password); self::assertTrue($this->Mail->send(), "S/MIME signing failed"); $msg = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("

\xaMIME-Version:", $msg, "Incorrect MIME headers"); unlink($certfile); unlink($keyfile); } public function testSigningWithCA() { $this->Mail->Subject .= ": S/MIME signing with CA"; $this->Mail->Body = "This message is S/MIME signed with an extra CA cert."; $this->buildBody(); $certprops = array("countryName" => "UK", "stateOrProvinceName" => "Here", "localityName" => "There", "organizationName" => "PHP", "organizationalUnitName" => "PHPMailer", "commonName" => "PHPMailer Test", "emailAddress" => "[email protected]"); $cacertprops = array("countryName" => "UK", "stateOrProvinceName" => "Here", "localityName" => "There", "organizationName" => "PHP", "organizationalUnitName" => "PHPMailer CA", "commonName" => "PHPMailer Test CA", "emailAddress" => "[email protected]"); $keyconfig = array("digest_alg" => "sha256", "private_key_bits" => 2048, "private_key_type" => OPENSSL_KEYTYPE_RSA); $password = "password"; $cacertfile = "cacertfile.pem"; $cakeyfile = "cakeyfile.pem"; $certfile = "certfile.pem"; $keyfile = "keyfile.pem"; $capk = openssl_pkey_new($keyconfig); $csr = openssl_csr_new($cacertprops, $capk); $cert = openssl_csr_sign($csr, null, $capk, 1); openssl_x509_export($cert, $certout); file_put_contents($cacertfile, $certout); openssl_pkey_export($capk, $pkeyout, $password); file_put_contents($cakeyfile, $pkeyout); $pk = openssl_pkey_new($keyconfig); $csr = openssl_csr_new($certprops, $pk); $cacert = file_get_contents($cacertfile); $cert = openssl_csr_sign($csr, $cacert, $capk, 1); openssl_x509_export($cert, $certout); file_put_contents($certfile, $certout); openssl_pkey_export($pk, $pkeyout, $password); file_put_contents($keyfile, $pkeyout); $this->Mail->sign($certfile, $keyfile, $password, $cacertfile); self::assertTrue($this->Mail->send(), "S/MIME signing with CA failed"); unlink($cacertfile); unlink($cakeyfile); unlink($certfile); unlink($keyfile); } public function testLineBreaks() { $this->Mail->isSMTP(); $this->Mail->preSend(); $this->Mail->Subject = "PHPMailer DOS line breaks"; $this->Mail->Body = "This message\xd\xacontains
DOS-format
\xaCRLF line breaks."; self::assertTrue($this->Mail->send()); $this->Mail->Subject = "PHPMailer UNIX line breaks"; $this->Mail->Body = "This message\xacontains\xaUNIX-format\xaLF line breaks."; self::assertTrue($this->Mail->send()); $this->Mail->Encoding = "quoted-printable"; $this->Mail->Subject = "PHPMailer DOS line breaks, QP"; $this->Mail->Body = "This message\xd
contains
\xaDOS-format
\xaCRLF line breaks."; self::assertTrue($this->Mail->send()); $this->Mail->Subject = "PHPMailer UNIX line breaks, QP"; $this->Mail->Body = "This message\xacontains
UNIX-format\xaLF line breaks."; self::assertTrue($this->Mail->send()); } public function testMiscellaneous() { $this->Mail->clearAttachments(); $this->Mail->isHTML(false); $this->Mail->isSMTP(); $this->Mail->isMail(); $this->Mail->isSendmail(); $this->Mail->isQmail(); $this->Mail->Sender = ''; self::assertEmpty($this->Mail->Sender); $this->Mail->createHeader(); } public function testBadSMTP() { $this->Mail->smtpConnect(); $smtp = $this->Mail->getSMTPInstance(); self::assertFalse($smtp->mail("somewhere
bad"), "Bad SMTP command containing breaks accepted"); } public function testConfirmReadingTo() { $this->Mail->CharSet = PHPMailer::CHARSET_UTF8; $this->buildBody(); $this->Mail->ConfirmReadingTo = "[email protected]"; self::assertFalse($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->ConfirmReadingTo = " [email protected]"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); self::assertSame("[email protected]", $this->Mail->ConfirmReadingTo, "Unexpected read receipt address"); $letter = html_entity_decode("&ccedil;", ENT_COMPAT, PHPMailer::CHARSET_UTF8); $this->Mail->ConfirmReadingTo = "test@fran" . $letter . "ois.ch"; if (PHPMailer::idnSupported()) { self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); self::assertSame("[email protected]", $this->Mail->ConfirmReadingTo, "IDN address not converted to punycode"); } else { self::assertFalse($this->Mail->send(), $this->Mail->ErrorInfo); } } public function testConvertEncoding() { if (!PHPMailer::idnSupported()) { self::markTestSkipped("intl and/or mbstring extensions are not available"); } $this->Mail->clearAllRecipients(); $letter = html_entity_decode("&ccedil;", ENT_COMPAT, PHPMailer::CHARSET_ISO88591); $domain = "@" . "fran" . $letter . "ois.ch"; $this->Mail->addAddress("test" . $domain); $this->Mail->addCC("test+cc" . $domain); $this->Mail->addBCC("test+bcc" . $domain); self::assertEmpty($this->Mail->getToAddresses(), "Bad "to" recipients"); self::assertEmpty($this->Mail->getCcAddresses(), "Bad "cc" recipients"); self::assertEmpty($this->Mail->getBccAddresses(), "Bad "bcc" recipients"); $this->Mail->clearBCCs(); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $domain = $this->Mail->punyencodeAddress($domain); self::assertSame(array(array("test" . $domain, '')), $this->Mail->getToAddresses(), "Bad "to" recipients"); self::assertSame(array(array("test+cc" . $domain, '')), $this->Mail->getCcAddresses(), "Bad "cc" recipients"); self::assertEmpty($this->Mail->getBccAddresses(), "Bad "bcc" recipients"); } public function testDuplicateIDNRemoved() { if (!PHPMailer::idnSupported()) { self::markTestSkipped("intl and/or mbstring extensions are not available"); } $this->Mail->clearAllRecipients(); $this->Mail->CharSet = PHPMailer::CHARSET_UTF8; self::assertTrue($this->Mail->addAddress("test@fran\303\247ois.ch")); self::assertFalse($this->Mail->addAddress("test@fran\xc3\247ois.ch")); self::assertTrue($this->Mail->addAddress("test@FRAN\303\x87OIS.CH")); self::assertFalse($this->Mail->addAddress("test@FRAN\xc3\x87OIS.CH")); self::assertTrue($this->Mail->addAddress("[email protected]")); self::assertFalse($this->Mail->addAddress("[email protected]")); self::assertFalse($this->Mail->addAddress("[email protected]")); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); self::assertCount(1, $this->Mail->getToAddresses(), "Bad count of "to" recipients"); } public function testSmtpXclient() { $this->Mail->isSMTP(); $this->Mail->SMTPAuth = false; $this->Mail->setSMTPXclientAttribute("ADDR", "127.0.0.1"); $this->Mail->setSMTPXclientAttribute("LOGIN", "[email protected]"); $this->Mail->setSMTPXclientAttribute("HELO", "test.example.com"); $this->assertFalse($this->Mail->setSMTPXclientAttribute("INVALID", "value")); $attributes = $this->Mail->getSMTPXclientAttributes(); $this->assertEquals("test.example.com", $attributes["HELO"]); $this->Mail->setSMTPXclientAttribute("HELO", null); $attributes = $this->Mail->getSMTPXclientAttributes(); $this->assertEquals(array("ADDR" => "127.0.0.1", "LOGIN" => "[email protected]"), $attributes); $this->Mail->Subject .= ": Testing XCLIENT"; $this->buildBody(); $this->Mail->clearAllRecipients(); self::assertTrue($this->Mail->addAddress("[email protected]"), "Addressing failed"); $this->Mail->preSend(); self::assertTrue($this->Mail->send(), "send failed"); } public function testSmtpConnect() { $this->Mail->SMTPDebug = SMTP::DEBUG_LOWLEVEL; self::assertTrue($this->Mail->smtpConnect(), "SMTP single connect failed"); $this->Mail->smtpClose(); $this->Mail->Host = " localhost:12345 ; " . $_REQUEST["mail_host"] . " "; self::assertTrue($this->Mail->smtpConnect(), "SMTP hosts with stray spaces failed"); $this->Mail->smtpClose(); $this->Mail->Host = $_REQUEST["mail_host"]; self::assertTrue($this->Mail->smtpConnect(array("ssl" => array("verify_depth" => 10)))); $this->Smtp = $this->Mail->getSMTPInstance(); self::assertInstanceOf(\get_class($this->Smtp), $this->Mail->setSMTPInstance($this->Smtp)); $this->Mail->smtpClose(); } public function testGivenIdnAddress_addAddress_returns_true() { if (file_exists(\PHPMAILER_INCLUDE_DIR . "/test/fakefunctions.php") === false) { $this->markTestSkipped("/test/fakefunctions.php file not found"); } include \PHPMAILER_INCLUDE_DIR . "/test/fakefunctions.php"; $this->assertTrue($this->Mail->addAddress("test@fran\xc3\247ois.ch")); } public function testErroneousAddress_addAddress_returns_false() { $this->assertFalse($this->Mail->addAddress("mehome.com")); } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace PHPMailer\Test\PHPMailer; use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\Test\SendTestCase; final class PHPMailerTest extends SendTestCase { private $Smtp; public function testLowPriority() { $this->Mail->Priority = 5; $this->Mail->Body = "\110\x65\162\145\40\x69\x73\40\164\x68\145\40\x6d\x61\151\156\x20\x62\157\144\171\x2e\40\x20\124\150\x65\162\145\40\163\150\x6f\165\154\x64\x20\x62\x65\40" . "\x61\40\162\145\x70\154\171\x20\x74\x6f\x20\x61\x64\x64\162\x65\x73\x73\40\151\x6e\x20\x74\150\x69\x73\40\x6d\145\x73\163\141\x67\145\56"; $this->Mail->Subject .= "\72\40\x4c\157\x77\x20\x50\162\x69\x6f\x72\151\x74\171"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testMultiplePlainFileAttachment() { $this->Mail->Body = "\110\x65\x72\145\x20\151\163\40\x74\x68\x65\x20\164\x65\x78\x74\x20\x62\157\x64\x79"; $this->Mail->Subject .= "\x3a\40\x50\x6c\x61\x69\156\x20\53\x20\115\165\154\164\x69\x70\x6c\x65\40\106\x69\x6c\145\101\x74\164\141\143\150\155\145\x6e\164\163"; if (!$this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "\x2f\145\x78\x61\155\160\154\x65\x73\x2f\151\x6d\141\147\x65\x73\x2f\x70\x68\x70\155\x61\x69\154\145\x72\56\x70\156\147"))) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } if (!$this->Mail->addAttachment(__FILE__, "\x74\145\163\x74\x2e\x74\170\164")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testRejectNonLocalFileAttachment() { self::assertFalse($this->Mail->addAttachment("\150\x74\x74\x70\x73\x3a\57\57\x67\x69\164\150\165\142\x2e\x63\157\x6d\57\x50\x48\120\x4d\x61\151\154\145\162\x2f\x50\110\x50\x4d\141\x69\x6c\x65\x72\57\x72\x61\167\x2f\x6d\x61\x73\x74\145\162\57\x52\x45\x41\x44\115\x45\x2e\155\x64"), "\141\144\144\101\164\x74\x61\x63\x68\x6d\x65\x6e\x74\x20\163\x68\x6f\x75\x6c\144\40\162\x65\x6a\145\x63\164\40\x72\145\155\157\x74\x65\40\125\122\114\x73"); self::assertFalse($this->Mail->addAttachment("\x70\x68\141\162\72\57\57\160\x68\141\x72\56\160\150\160"), "\x61\x64\144\x41\164\x74\x61\143\150\155\x65\156\x74\x20\x73\150\157\x75\x6c\x64\40\x72\145\152\145\x63\164\40\160\150\141\x72\40\x72\x65\x73\x6f\x75\x72\x63\x65\x73"); } public function testQuotedPrintable() { $this->Mail->Body = "\110\145\x72\x65\x20\x69\x73\40\x74\x68\x65\40\x6d\141\x69\156\x20\142\157\144\171"; $this->Mail->Subject .= "\x3a\40\120\x6c\x61\151\x6e\x20\53\x20\x51\x75\x6f\x74\145\x64\55\160\x72\151\156\x74\x61\x62\x6c\145"; $this->Mail->Encoding = "\161\165\157\x74\145\x64\55\160\162\151\x6e\x74\x61\x62\154\145"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $t = file_get_contents(__FILE__); $t = str_replace(array("\xd\xa", "\xd"), "\xa", $t); self::assertSame($t, quoted_printable_decode($this->Mail->encodeQP($t)), "\121\x75\x6f\x74\145\144\x2d\120\162\x69\x6e\x74\141\x62\x6c\x65\x20\145\156\x63\157\x64\151\x6e\x67\40\x72\157\165\x6e\x64\55\x74\x72\x69\160\40\x66\x61\151\x6c\x65\x64"); $t = str_replace("\xa", "\15\xa", $t); self::assertSame($t, quoted_printable_decode($this->Mail->encodeQP($t)), "\x51\165\x6f\164\x65\144\55\x50\162\151\x6e\x74\x61\142\154\x65\x20\145\x6e\143\157\x64\x69\x6e\x67\x20\x72\157\165\156\144\x2d\164\162\151\x70\x20\x66\141\x69\x6c\145\144\x20\x28\127\151\156\x64\157\167\163\x20\x6c\x69\x6e\145\x20\x62\x72\x65\141\153\163\51"); } public function testHeaderEncoding() { $this->Mail->CharSet = PHPMailer::CHARSET_UTF8; $letter = html_entity_decode("\x26\145\141\x63\165\x74\x65\73", ENT_COMPAT, PHPMailer::CHARSET_UTF8); $bencode = str_repeat($letter, PHPMailer::STD_LINE_LENGTH + 1); $qencode = str_repeat("\x65", PHPMailer::STD_LINE_LENGTH) . $letter; $bencodenofold = str_repeat($letter, 10); $qencodenofold = str_repeat("\145", 9) . $letter; $longheader = str_repeat("\x65", PHPMailer::STD_LINE_LENGTH + 10); $longutf8 = str_repeat($letter, PHPMailer::STD_LINE_LENGTH + 10); $noencode = "\x65\145\145\145\x65\145\145\x65\145\x65"; $this->Mail->isMail(); $bencoderes = "\75\77\165\164\146\x2d\70\77\102\x3f\167\x36\x6e\x44\161\143\117\x70\167\x36\x6e\x44\161\143\x4f\160\167\x36\156\x44\161\x63\117\x70\x77\x36\156\104\x71\143\x4f\x70\167\66\156\x44\161\x63\117\160\167\x36\x6e\104\x71\143\x4f\x70\167\66\x6e\x44\x71\x63\117\160\167\x36\153\x3d\77\75" . PHPMailer::getLE() . "\40\x3d\x3f\165\x74\146\x2d\x38\x3f\102\77\x77\66\156\x44\x71\x63\x4f\x70\x77\x36\156\x44\161\143\x4f\160\x77\66\x6e\104\x71\x63\x4f\160\x77\x36\156\x44\x71\143\x4f\160\x77\x36\156\x44\x71\143\x4f\x70\x77\x36\156\104\x71\143\117\x70\167\66\156\104\161\x63\117\160\x77\x36\x6b\x3d\x3f\75" . PHPMailer::getLE() . "\x20\75\x3f\x75\x74\x66\55\70\x3f\102\77\167\66\x6e\x44\161\x63\x4f\160\x77\x36\x6e\x44\161\143\x4f\160\167\x36\x6e\x44\x71\143\117\160\167\66\x6e\104\161\x63\x4f\x70\x77\66\x6e\x44\x71\x63\x4f\x70\x77\66\156\x44\x71\x63\117\160\x77\66\156\104\x71\x63\x4f\x70\x77\x36\153\75\77\x3d" . PHPMailer::getLE() . "\40\x3d\x3f\165\164\146\x2d\x38\77\102\x3f\167\x36\156\x44\161\x63\117\x70\167\x36\x6e\x44\x71\143\x4f\x70\167\66\x6e\104\x71\x63\117\160\x77\66\156\104\161\x51\75\75\x3f\x3d"; $qencoderes = "\x3d\x3f\x75\164\x66\55\x38\77\x51\x3f\x65\x65\x65\145\145\145\145\145\145\x65\x65\x65\145\x65\x65\x65\145\x65\x65\x65\145\x65\145\145\145\145\x65\x65\x65\145\145\145\145\x65\145\x65\145\145\x65\145\x65\145\x65\145\x65\x65\x65\x65\145\145\77\x3d" . PHPMailer::getLE() . "\x20\x3d\x3f\x75\164\x66\x2d\70\x3f\121\x3f\x65\145\145\145\x65\x65\x65\145\x65\145\145\x65\x65\x65\x65\145\x65\145\x65\145\x65\145\x65\145\x65\x65\75\x43\63\75\101\71\x3f\x3d"; $bencodenofoldres = "\x3d\77\x75\x74\x66\x2d\70\77\102\77\x77\66\x6e\x44\161\x63\x4f\160\167\x36\156\x44\x71\x63\x4f\160\x77\66\156\104\161\143\117\x70\x77\66\x6b\x3d\77\75"; $qencodenofoldres = "\x3d\77\x75\164\x66\55\70\77\121\x3f\145\145\x65\x65\x65\x65\x65\145\x65\x3d\x43\63\75\101\x39\77\75"; $longheaderres = "\x3d\77\165\x73\55\x61\x73\143\x69\x69\x3f\x51\x3f\x65\x65\145\145\x65\145\145\145\145\145\145\145\145\145\x65\x65\145\x65\x65\145\145\145\x65\x65\145\x65\145\x65\145\x65\145\x65\x65\x65\x65\x65\x65\145\x65\145\145\145\x65\x65\x65\x65\x65\x3f\75" . PHPMailer::getLE() . "\x20\75\x3f\165\163\55\x61\x73\x63\x69\x69\77\x51\x3f\145\145\x65\x65\x65\x65\145\x65\x65\145\145\145\145\x65\145\145\145\x65\x65\145\145\145\145\145\145\x65\x65\x65\145\x65\x65\145\x65\x65\145\x65\145\145\x65\77\x3d"; $longutf8res = "\x3d\77\x75\x74\x66\55\x38\x3f\102\77\x77\x36\x6e\x44\x71\x63\117\x70\x77\x36\156\x44\x71\x63\x4f\160\x77\66\x6e\104\161\143\x4f\160\167\66\x6e\104\x71\x63\117\x70\167\66\x6e\x44\161\143\117\160\167\66\x6e\x44\161\x63\x4f\160\167\x36\x6e\x44\x71\143\x4f\160\167\66\x6b\75\77\x3d" . PHPMailer::getLE() . "\40\x3d\x3f\165\x74\x66\55\70\x3f\x42\x3f\x77\66\x6e\104\x71\x63\117\x70\x77\66\156\104\161\143\x4f\160\x77\66\156\x44\x71\x63\117\x70\167\x36\x6e\x44\161\143\117\x70\x77\x36\x6e\104\x71\x63\x4f\160\167\x36\156\x44\161\143\x4f\x70\167\x36\156\104\x71\143\x4f\160\x77\66\153\75\x3f\x3d" . PHPMailer::getLE() . "\40\x3d\77\165\x74\x66\55\70\x3f\x42\77\x77\x36\156\104\161\x63\117\160\x77\66\x6e\x44\161\x63\117\x70\167\x36\156\x44\161\x63\117\160\x77\x36\x6e\x44\161\143\117\x70\x77\x36\156\104\x71\x63\x4f\x70\x77\66\156\104\161\x63\117\x70\167\x36\x6e\x44\x71\x63\117\160\167\66\x6b\x3d\x3f\x3d" . PHPMailer::getLE() . "\40\75\x3f\x75\164\146\55\70\77\x42\77\x77\x36\x6e\104\161\x63\117\160\167\66\x6e\x44\x71\143\x4f\160\x77\66\x6e\104\161\143\117\x70\x77\x36\x6e\x44\x71\143\117\160\x77\x36\156\104\161\x63\x4f\160\167\66\x6e\x44\x71\143\117\160\167\x36\x6e\104\x71\121\75\75\x3f\x3d"; $noencoderes = "\x65\145\x65\x65\x65\145\x65\145\x65\x65"; self::assertSame($bencoderes, $this->Mail->encodeHeader($bencode), "\106\157\154\x64\x65\144\x20\102\x2d\145\x6e\143\x6f\144\x65\144\40\150\145\x61\x64\x65\x72\40\166\x61\154\x75\x65\x20\151\x6e\143\x6f\x72\162\x65\143\x74"); self::assertSame($qencoderes, $this->Mail->encodeHeader($qencode), "\106\x6f\154\144\145\144\40\121\x2d\x65\156\143\x6f\144\x65\x64\40\x68\x65\x61\144\145\x72\40\x76\x61\154\x75\145\x20\151\156\143\x6f\162\x72\x65\x63\164"); self::assertSame($bencodenofoldres, $this->Mail->encodeHeader($bencodenofold), "\x42\x2d\145\x6e\143\157\144\145\144\40\x68\x65\x61\144\x65\x72\40\166\141\x6c\x75\x65\x20\x69\156\143\x6f\162\x72\x65\143\x74"); self::assertSame($qencodenofoldres, $this->Mail->encodeHeader($qencodenofold), "\x51\55\x65\x6e\143\157\144\x65\144\40\x68\x65\x61\144\145\162\x20\x76\x61\x6c\x75\145\40\x69\156\x63\157\162\162\145\143\x74"); self::assertSame($longheaderres, $this->Mail->encodeHeader($longheader), "\114\x6f\156\x67\x20\x68\x65\141\144\145\162\x20\166\141\154\x75\x65\x20\x69\x6e\143\x6f\162\x72\x65\x63\164"); self::assertSame($longutf8res, $this->Mail->encodeHeader($longutf8), "\x4c\157\x6e\147\40\125\x54\x46\55\x38\40\150\x65\141\x64\145\162\x20\166\x61\x6c\165\x65\40\151\x6e\x63\157\162\x72\x65\143\x74"); self::assertSame($noencoderes, $this->Mail->encodeHeader($noencode), "\x55\156\145\156\143\x6f\x64\145\144\40\150\145\x61\144\145\162\x20\x76\141\x6c\x75\x65\x20\x69\x6e\x63\x6f\162\x72\145\x63\164"); } public function testHtml() { $this->Mail->isHTML(true); $this->Mail->Subject .= "\72\x20\110\124\115\x4c\40\x6f\156\x6c\x79"; $this->Mail->Body = "\74\x21\104\117\103\124\131\x50\105\x20\x68\164\x6d\154\x3e\12\74\150\x74\155\x6c\x20\x6c\x61\x6e\x67\75\42\x65\156\42\76\xa\40\40\x20\x20\74\150\x65\x61\144\76\xa\x20\x20\x20\40\40\x20\x20\x20\x3c\164\151\x74\x6c\145\76\110\x54\x4d\x4c\40\x65\155\141\151\154\40\x74\145\x73\x74\x3c\x2f\x74\151\x74\x6c\145\x3e\xa\40\40\40\x20\x3c\x2f\150\145\141\x64\x3e\12\x20\40\40\x20\x3c\142\x6f\x64\171\76\12\x20\40\x20\x20\x20\x20\x20\x20\74\x68\61\76\x50\110\120\115\141\x69\x6c\x65\162\40\144\x6f\145\x73\x20\x48\124\x4d\114\x21\x3c\57\150\61\x3e\xa\x20\40\40\x20\x20\x20\x20\40\x3c\160\x3e\124\x68\x69\163\40\x69\x73\40\141\40\x3c\163\164\162\157\x6e\147\x3e\164\145\163\x74\40\x6d\x65\x73\163\141\147\145\x3c\x2f\163\164\162\x6f\156\x67\76\40\x77\162\x69\164\164\145\156\40\x69\156\40\x48\124\115\114\x2e\x3c\142\x72\76\12\x20\40\40\40\x20\x20\40\x20\107\157\40\164\157\x20\74\x61\40\150\x72\x65\x66\x3d\42\x68\x74\164\160\163\72\x2f\57\x67\x69\164\x68\165\x62\56\143\157\x6d\x2f\x50\110\120\115\141\x69\154\145\162\x2f\120\x48\x50\x4d\141\x69\x6c\x65\162\57\x22\76\x68\164\164\160\x73\x3a\57\x2f\x67\x69\x74\x68\x75\142\x2e\143\x6f\155\x2f\120\x48\x50\115\141\151\154\x65\x72\x2f\120\x48\120\x4d\x61\x69\x6c\x65\x72\57\74\57\x61\76\12\40\40\40\x20\40\x20\40\40\146\x6f\x72\x20\156\x65\167\x20\x76\145\162\x73\151\157\156\x73\x20\157\146\40\120\x48\x50\x4d\x61\151\x6c\145\x72\x2e\74\57\x70\x3e\xa\x20\x20\40\40\x20\40\x20\40\74\x70\x3e\124\x68\141\x6e\x6b\40\x79\x6f\x75\x21\74\x2f\160\76\xa\x20\x20\x20\40\74\x2f\x62\157\144\x79\x3e\xa\74\57\x68\164\155\x6c\76"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $msg = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("\xd\12\xd\xa\115\111\x4d\x45\55\x56\x65\162\x73\151\x6f\x6e\x3a", $msg, "\111\x6e\x63\157\x72\162\x65\143\x74\40\115\111\x4d\105\x20\150\145\141\x64\x65\x72\x73"); } public function testDsn() { $this->Mail->isHTML(true); $this->Mail->Subject .= "\x3a\x20\110\124\115\x4c\x20\157\156\x6c\171"; $this->Mail->Body = "\74\x21\104\x4f\103\124\131\x50\105\40\150\164\x6d\154\76\xa\x3c\150\164\155\x6c\x20\x6c\x61\156\147\75\x22\145\x6e\x22\x3e\12\40\x20\x20\40\74\150\x65\141\x64\76\12\40\x20\x20\x20\x20\x20\40\x20\x3c\x74\151\164\154\x65\x3e\x48\124\x4d\114\x20\x65\x6d\x61\x69\x6c\40\x74\x65\x73\164\74\x2f\164\x69\x74\x6c\x65\76\xa\x20\x20\40\x20\x3c\57\x68\x65\x61\144\x3e\xa\x20\x20\40\40\74\142\157\144\x79\x3e\xa\x20\x20\40\x20\x20\x20\40\40\74\160\x3e\x50\x48\120\x4d\x61\x69\154\x65\162\74\57\x70\x3e\xa\40\40\40\x20\74\x2f\x62\157\x64\171\76\xa\74\x2f\150\164\x6d\154\76"; $this->buildBody(); $this->Mail->dsn = "\x53\x55\103\x43\105\x53\123\54\106\101\x49\114\x55\x52\105"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->dsn = "\116\105\x56\105\122"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testCreateBody() { $PHPMailer = new PHPMailer(); $reflection = new \ReflectionClass($PHPMailer); $property = $reflection->getProperty("\x6d\145\x73\x73\141\147\x65\x5f\x74\171\x70\145"); $property->setAccessible(true); $property->setValue($PHPMailer, "\x69\x6e\154\x69\x6e\x65"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "\x61\x74\164\x61\143\x68"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "\151\156\154\151\x6e\x65\137\x61\x74\164\x61\143\x68"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "\141\x6c\164"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "\141\154\x74\x5f\x69\x6e\x6c\151\x6e\x65"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "\x61\x6c\x74\137\141\x74\x74\141\x63\150"); self::assertIsString($PHPMailer->createBody()); $property->setValue($PHPMailer, "\x61\x6c\x74\x5f\x69\x6e\154\151\x6e\x65\137\141\164\x74\x61\143\x68"); self::assertIsString($PHPMailer->createBody()); } public function testHtmlIso8859() { $this->Mail->isHTML(true); $this->Mail->Subject .= "\72\40\x49\123\x4f\55\x38\x38\x35\71\55\61\x20\110\x54\115\114"; $this->Mail->CharSet = PHPMailer::CHARSET_ISO88591; $content = file_get_contents(realpath(\PHPMAILER_INCLUDE_DIR . "\x2f\145\170\x61\155\x70\x6c\145\163\x2f\x63\157\156\x74\145\x6e\164\163\x2e\x68\x74\x6d\154")); $check = base64_decode("\x36\145\x6a\x75\x2f\x4f\146\106\x38\x65\x62\146"); $this->Mail->msgHTML(mb_convert_encoding($content, "\x49\123\117\x2d\x38\70\x35\x39\x2d\x31", mb_detect_encoding($content, "\125\124\x46\55\70\54\x20\x49\x53\x4f\x2d\x38\70\x35\71\x2d\x31\54\x20\x49\123\117\x2d\x38\x38\65\71\55\61\65", true)), realpath(\PHPMAILER_INCLUDE_DIR . "\57\x65\x78\141\x6d\x70\154\x65\x73")); $this->buildBody(); self::assertStringContainsString($check, $this->Mail->Body, "\x49\123\117\40\x6d\x65\x73\163\141\147\145\x20\x62\157\144\171\x20\144\157\145\163\x20\156\157\164\40\143\x6f\x6e\x74\141\x69\156\x20\145\170\160\145\x63\x74\145\144\40\164\x65\170\164"); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testHtmlUtf8() { $this->Mail->isHTML(true); $this->Mail->Subject .= "\x3a\40\125\124\x46\55\70\x20\x48\x54\115\x4c\40\320\x9f\xd1\x83\321\x81\321\x82\320\276\xd0\xb5\40\321\x82\xd0\265\320\xbb\xd0\xbe\40\xd1\x81\xd0\276\xd0\276\xd0\xb1\xd1\211\320\265\xd0\xbd\xd0\270\xd1\217"; $this->Mail->CharSet = "\125\x54\106\x2d\x38"; $this->Mail->Body = "\x3c\x21\x44\x4f\x43\x54\131\120\x45\x20\150\x74\x6d\154\76\xa\74\150\x74\x6d\154\40\154\x61\156\x67\75\42\145\x6e\x22\x3e\xa\x20\x20\40\40\x3c\x68\145\141\x64\76\xa\40\40\40\x20\x20\x20\40\x20\74\x6d\145\x74\x61\40\150\x74\164\160\x2d\145\x71\165\x69\166\x3d\x22\x43\x6f\x6e\x74\145\x6e\164\55\x54\x79\x70\145\42\x20\x63\157\156\x74\145\156\164\x3d\x22\x74\145\x78\164\57\150\x74\x6d\154\x3b\x20\143\x68\x61\162\163\x65\x74\75\x75\164\146\55\x38\x22\x3e\xa\40\x20\40\40\40\40\40\40\x3c\164\x69\x74\154\145\x3e\x48\x54\115\114\x20\x65\x6d\x61\151\x6c\x20\x74\x65\163\x74\74\57\x74\151\x74\154\145\x3e\xa\x20\40\x20\x20\74\x2f\150\x65\141\x64\76\xa\40\x20\40\40\x3c\142\x6f\x64\171\76\xa\40\40\x20\x20\40\40\x20\40\74\x70\x3e\103\150\x69\156\145\x73\145\x20\164\145\170\x74\x3a\40\xe9\203\265\xe4\xbb\xb6\345\205\xa7\345\xae\xb9\347\x82\xba\xe7\xa9\xba\74\x2f\160\76\12\40\x20\x20\x20\x20\x20\40\40\x3c\160\x3e\122\x75\x73\163\151\141\x6e\x20\164\145\x78\x74\72\x20\xd0\x9f\321\x83\xd1\201\321\202\320\276\320\265\x20\xd1\202\320\265\xd0\xbb\xd0\xbe\x20\xd1\x81\320\xbe\xd0\276\320\261\xd1\x89\320\265\320\xbd\xd0\xb8\321\217\x3c\x2f\160\76\12\40\40\40\x20\40\40\40\x20\74\160\x3e\x41\x72\155\x65\x6e\151\x61\156\40\x74\145\x78\x74\x3a\x20\xd5\x80\xd5\241\325\262\xd5\xb8\326\x80\xd5\244\xd5\241\325\xa3\xd6\x80\xd5\270\xd6\x82\xd5\251\325\265\xd5\xb8\326\x82\325\xb6\325\xa8\40\xd5\xa4\xd5\xa1\325\xbf\325\xa1\xd6\x80\xd5\257\x20\325\247\74\57\160\76\xa\x20\40\40\40\40\40\x20\x20\x3c\160\x3e\103\x7a\x65\x63\x68\x20\164\145\x78\x74\72\40\120\x72\303\241\x7a\x64\156\xc3\xa9\40\164\304\233\x6c\157\40\x7a\x70\162\xc3\241\166\171\x3c\x2f\160\x3e\12\x20\40\x20\x20\74\x2f\142\x6f\144\x79\x3e\12\74\57\x68\x74\x6d\x6c\76"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $msg = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("\xd\12\15\12\x4d\x49\x4d\x45\x2d\126\x65\162\x73\151\x6f\x6e\72", $msg, "\111\156\143\x6f\x72\162\x65\143\x74\40\x4d\x49\x4d\105\x20\x68\145\x61\x64\x65\x72\163"); } public function testUtf8WithEmbeddedImage() { $this->Mail->isHTML(true); $this->Mail->Subject .= "\x3a\x20\125\x54\x46\55\70\x20\167\x69\x74\150\40\145\155\x62\145\x64\144\145\144\x20\x69\155\x61\147\x65"; $this->Mail->CharSet = "\125\x54\x46\55\70"; $this->Mail->Body = "\74\41\x44\117\x43\x54\x59\x50\x45\40\x68\x74\155\x6c\x3e\xa\x3c\150\164\x6d\x6c\x20\154\x61\156\147\x3d\x22\145\x6e\x22\76\xa\x20\40\40\40\x3c\x68\145\x61\144\x3e\12\40\x20\x20\x20\40\40\x20\x20\74\155\x65\x74\x61\40\x68\x74\164\160\55\145\161\165\151\x76\75\x22\x43\x6f\x6e\x74\145\x6e\x74\55\124\x79\x70\145\42\x20\x63\x6f\x6e\x74\145\x6e\x74\75\42\x74\145\x78\x74\x2f\x68\x74\x6d\x6c\73\40\143\x68\141\x72\x73\x65\164\75\165\164\146\x2d\x38\42\x3e\xa\x20\x20\x20\40\40\40\40\x20\x3c\164\x69\x74\x6c\145\x3e\110\x54\x4d\x4c\x20\145\155\x61\151\x6c\40\164\145\163\164\x3c\57\164\x69\164\154\145\76\12\x20\40\40\x20\74\57\150\145\141\144\x3e\12\40\x20\40\x20\74\x62\157\x64\171\x3e\xa\40\x20\x20\x20\40\x20\x20\x20\x3c\160\76\103\x68\x69\x6e\145\163\145\x20\164\145\x78\x74\72\x20\351\203\265\xe4\xbb\xb6\xe5\205\xa7\xe5\256\271\347\202\xba\347\251\272\x3c\57\x70\x3e\12\x20\x20\x20\40\x20\x20\x20\x20\74\x70\76\x52\165\x73\163\x69\x61\156\40\x74\x65\x78\164\72\40\xd0\237\321\x83\321\x81\321\202\xd0\xbe\320\265\40\xd1\202\320\265\xd0\xbb\320\276\40\321\201\xd0\276\xd0\xbe\320\xb1\xd1\x89\320\265\xd0\xbd\xd0\270\xd1\217\74\x2f\x70\76\12\x20\40\40\x20\40\x20\40\x20\x3c\x70\76\x41\x72\x6d\x65\156\x69\x61\x6e\x20\164\x65\170\164\x3a\x20\325\x80\xd5\xa1\xd5\xb2\325\xb8\326\x80\xd5\244\325\xa1\325\243\xd6\200\xd5\270\326\x82\xd5\xa9\325\265\325\270\xd6\202\xd5\266\325\250\40\xd5\xa4\325\xa1\xd5\xbf\xd5\241\326\200\325\xaf\40\xd5\247\x3c\57\160\x3e\xa\x20\x20\40\40\40\x20\40\40\x3c\x70\76\103\x7a\145\143\150\40\164\145\x78\x74\x3a\40\120\x72\xc3\xa1\x7a\144\x6e\xc3\xa9\x20\x74\xc4\233\x6c\x6f\x20\x7a\160\x72\xc3\241\x76\171\x3c\57\160\x3e\xa\x20\x20\x20\x20\40\40\x20\40\x45\x6d\x62\145\144\x64\145\x64\x20\111\155\x61\x67\x65\x3a\40\x3c\151\x6d\147\x20\x61\154\164\75\x22\x70\150\x70\x6d\x61\151\x6c\145\162\42\x20\163\162\143\x3d\x22\x63\x69\144\72\x62\xc3\244\143\x6b\42\x3e\12\x20\40\40\x20\x3c\57\x62\x6f\x64\x79\x3e\xa\x3c\x2f\x68\x74\155\154\x3e"; $this->Mail->addEmbeddedImage(realpath(\PHPMAILER_INCLUDE_DIR . "\x2f\x65\170\x61\x6d\x70\x6c\x65\x73\57\x69\x6d\141\147\145\x73\57\x70\x68\160\x6d\141\x69\154\x65\162\x2e\x70\x6e\147"), "\142\303\xa4\x63\153", "\x70\x68\160\x6d\x61\x69\154\145\162\56\x70\x6e\x67", "\x62\x61\163\x65\66\64", "\x69\155\141\147\145\57\x70\x6e\147"); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testPlainUtf8() { $this->Mail->isHTML(false); $this->Mail->Subject .= "\x3a\x20\125\124\106\x2d\x38\40\x70\154\141\x69\156\x20\x74\145\170\x74"; $this->Mail->CharSet = "\125\124\x46\x2d\70"; $this->Mail->Body = "\x43\x68\151\x6e\x65\163\x65\40\x74\145\170\x74\72\x20\xe9\203\265\344\273\266\xe5\205\xa7\345\256\271\xe7\x82\272\xe7\251\272\xa\122\x75\x73\163\x69\x61\x6e\40\x74\x65\x78\164\72\x20\320\x9f\xd1\203\321\x81\321\x82\320\276\320\265\40\xd1\202\320\xb5\320\xbb\xd0\276\x20\xd1\x81\xd0\276\xd0\xbe\xd0\xb1\321\211\320\xb5\xd0\275\xd0\xb8\321\x8f\12\x41\162\155\145\x6e\151\141\156\x20\x74\x65\x78\164\72\40\325\x80\xd5\241\xd5\xb2\325\xb8\326\x80\325\244\xd5\xa1\xd5\xa3\xd6\200\325\xb8\326\x82\xd5\251\325\265\xd5\270\xd6\202\xd5\266\xd5\xa8\40\xd5\244\325\241\xd5\277\325\xa1\326\x80\325\xaf\40\xd5\247\xa\103\172\145\x63\x68\x20\164\145\170\164\x3a\x20\120\x72\xc3\241\172\144\x6e\xc3\xa9\x20\164\304\233\154\157\x20\172\160\x72\xc3\241\x76\x79"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $msg = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("\xd\xa\15\12\115\x49\x4d\x45\x2d\126\x65\162\163\x69\x6f\x6e\72", $msg, "\111\x6e\143\x6f\162\x72\145\x63\x74\x20\115\111\x4d\x45\40\x68\x65\x61\144\x65\x72\163"); } public function testMsgHTML() { $message = file_get_contents(realpath(\PHPMAILER_INCLUDE_DIR . "\57\x65\170\x61\x6d\x70\x6c\x65\x73\x2f\143\157\x6e\164\x65\156\x74\x73\165\164\x66\x38\56\150\x74\155\x6c")); $this->Mail->CharSet = PHPMailer::CHARSET_UTF8; $this->Mail->Body = ''; $this->Mail->AltBody = ''; $this->Mail->msgHTML($message, realpath(\PHPMAILER_INCLUDE_DIR . "\x2f\x65\170\141\155\x70\154\145\163")); $sub = $this->Mail->Subject . "\x3a\40\x6d\163\x67\x48\124\115\x4c"; $this->Mail->Subject .= $sub; self::assertNotEmpty($this->Mail->Body, "\102\157\144\171\x20\x6e\x6f\x74\x20\163\145\x74\x20\x62\x79\x20\x6d\163\x67\x48\x54\x4d\114"); self::assertNotEmpty($this->Mail->AltBody, "\101\x6c\164\102\157\x64\171\x20\156\x6f\x74\40\x73\145\x74\40\142\171\x20\155\x73\147\110\x54\x4d\114"); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->AltBody = ''; $this->Mail->msgHTML($message, realpath(\PHPMAILER_INCLUDE_DIR . "\57\x65\170\x61\155\160\154\x65\x73"), static function ($html) { return strtoupper(strip_tags($html)); }); $this->Mail->Subject = $sub . "\x20\x2b\x20\x63\165\163\164\x6f\155\40\x68\x74\155\x6c\x32\x74\x65\x78\x74"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->msgHTML("\x3c\151\155\x67\x20\163\x72\143\x3d\42\57\145\164\x63\x2f\x68\157\163\x74\156\x61\155\x65\x22\x3e\164\x65\x73\x74"); self::assertStringContainsString("\x73\162\x63\75\x22\x2f\x65\164\x63\x2f\x68\x6f\x73\x74\156\141\x6d\145\42", $this->Mail->Body); $this->Mail->msgHTML("\74\151\155\147\40\163\162\x63\75\42\x63\157\155\x70\x6f\x73\x65\162\x2e\x6a\163\157\x6e\x22\x3e\164\145\163\x74", realpath(\PHPMAILER_INCLUDE_DIR)); self::assertStringNotContainsString("\163\x72\x63\75\42\x63\x6f\155\x70\157\163\145\162\x2e\152\163\157\156\42", $this->Mail->Body); $this->Mail->msgHTML("\74\151\x6d\x67\x20\x73\162\x63\75\42\x2e\56\57\x63\x6f\155\160\157\163\145\x72\56\152\x73\x6f\x6e\x22\76\164\x65\163\164", realpath(\PHPMAILER_INCLUDE_DIR)); self::assertStringNotContainsString("\x73\x72\x63\75\x22\143\x6f\x6d\160\x6f\x73\x65\x72\x2e\x6a\163\x6f\x6e\x22", $this->Mail->Body); $this->Mail->msgHTML("\74\x69\x6d\x67\x20\x73\162\x63\75\42\x63\x69\x64\x3a\x35\x64\64\61\64\x30\x32\141\142\143\x34\x62\62\141\x37\66\x62\x39\67\61\x39\x64\71\x31\x31\60\61\67\x63\65\71\62\42\76\164\145\x73\164"); self::assertStringContainsString("\163\162\x63\75\42\x63\x69\x64\x3a\65\144\x34\61\64\x30\x32\141\x62\x63\x34\x62\62\141\67\66\142\71\x37\x31\x39\x64\71\61\61\x30\61\x37\x63\65\x39\x32\42", $this->Mail->Body); $this->Mail->msgHTML("\74\151\155\x67\40\x73\162\143\x3d\x22\150\x74\x74\x70\163\x3a\57\57\147\x69\164\x68\x75\x62\x2e\x63\157\155\57\x50\x48\120\x4d\x61\151\154\x65\x72\57\x50\x48\120\115\141\151\154\145\x72\x2f\142\154\x6f\142\57\155\141\x73\x74\x65\x72\57\143\x6f\x6d\160\157\x73\145\x72\x2e\x6a\x73\x6f\x6e\42\x3e\164\145\x73\164"); self::assertStringContainsString("\x73\x72\143\x3d\42\x68\x74\x74\x70\163\72\57\57\x67\x69\x74\150\x75\x62\56\x63\157\155\57\x50\110\x50\x4d\x61\151\x6c\x65\162\57\120\110\x50\x4d\x61\x69\154\x65\162\57\142\x6c\x6f\142\57\x6d\x61\163\x74\x65\x72\57\143\x6f\155\160\x6f\163\x65\x72\x2e\x6a\163\x6f\156\x22", $this->Mail->Body); $this->Mail->msgHTML("\x3c\x69\155\x67\40\x73\162\143\x3d\x22\x2f\57\x67\x69\164\x68\x75\x62\56\143\x6f\155\x2f\120\110\x50\115\141\x69\x6c\145\162\x2f\120\x48\120\115\x61\151\154\145\x72\x2f\142\154\157\x62\57\155\x61\163\164\145\162\57\143\157\155\x70\x6f\163\x65\x72\x2e\x6a\163\x6f\156\x22\x3e\x74\145\163\x74"); self::assertStringContainsString("\163\x72\x63\x3d\x22\57\x2f\147\x69\x74\150\165\142\x2e\143\157\155\x2f\x50\110\120\x4d\x61\x69\154\145\x72\x2f\120\110\x50\115\x61\151\154\145\x72\x2f\142\x6c\157\142\57\155\141\163\164\145\162\57\143\x6f\155\x70\x6f\x73\145\162\56\x6a\x73\157\156\42", $this->Mail->Body); } public function testHTMLAttachment() { $this->Mail->Body = "\124\x68\x69\x73\40\x69\163\x20\164\150\145\x20\74\x73\x74\162\157\156\x67\x3e\110\124\x4d\114\74\57\163\164\162\x6f\x6e\147\x3e\40\160\x61\162\164\x20\157\x66\x20\x74\x68\x65\40\145\155\141\x69\x6c\56"; $this->Mail->Subject .= "\72\x20\x48\x54\115\114\x20\53\40\101\164\x74\141\143\x68\x6d\x65\156\164"; $this->Mail->isHTML(true); $this->Mail->CharSet = "\x55\124\106\x2d\x38"; if (!$this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "\x2f\145\170\141\155\160\154\145\163\57\x69\x6d\x61\147\x65\163\x2f\x70\150\x70\x6d\x61\151\x6c\x65\x72\137\155\151\156\x69\56\x70\x6e\147"), "\x70\x68\x70\x6d\141\x69\x6c\x65\x72\137\x6d\x69\156\x69\56\160\x6e\x67")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } self::assertFalse($this->Mail->addAttachment("\x70\150\x61\162\x3a\x2f\x2f\x70\x68\x61\x72\x66\x69\154\145\x2e\160\x68\160", "\x70\150\141\162\146\151\x6c\x65\x2e\x70\x68\160")); self::assertFalse($this->Mail->addAttachment("\150\164\x74\160\163\72\57\57\145\170\141\155\x70\x6c\x65\x2e\x63\x6f\155\x2f\x74\145\163\164\56\x70\150\x70", "\x74\145\163\164\x2e\160\x68\x70")); self::assertFalse($this->Mail->addAttachment("\163\163\x68\62\x2e\x73\146\164\x70\x3a\x2f\x2f\165\x73\145\x72\72\x70\x61\163\163\x40\141\x74\164\141\143\x6b\x65\x72\x2d\x63\157\156\164\x72\x6f\154\154\145\x64\x2e\145\170\x61\155\x70\x6c\x65\56\x63\x6f\155\72\62\62\57\x74\x6d\x70\57\160\x61\x79\154\x6f\x61\144\x2e\x70\150\x61\x72", "\x74\x65\163\x74\56\160\x68\x70")); self::assertFalse($this->Mail->addAttachment("\x78\55\61\56\143\x64\53\55\72\57\x2f\x65\x78\x61\x6d\160\154\x65\56\143\x6f\x6d\x2f\164\x65\x73\x74\x2e\160\150\x70", "\164\x65\163\x74\x2e\x70\x68\160")); $filename = __FILE__ . md5(microtime()) . "\156\157\156\145\170\151\x73\164\x65\x6e\x74\137\x66\x69\x6c\x65\56\x74\170\x74"; self::assertFalse($this->Mail->addAttachment($filename)); touch($filename); chmod($filename, 128); self::assertFalse($this->Mail->addAttachment($filename)); chmod($filename, 420); unlink($filename); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testAttachmentNaming() { $this->Mail->Body = "\x41\x74\x74\x61\143\150\155\145\156\164\163\x2e"; $this->Mail->Subject .= "\72\40\x41\x74\164\x61\x63\x68\155\145\x6e\164\x73"; $this->Mail->isHTML(true); $this->Mail->CharSet = "\x55\x54\x46\x2d\70"; $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "\57\145\x78\x61\x6d\x70\x6c\145\x73\57\x69\155\x61\x67\145\163\57\x70\x68\160\x6d\x61\151\x6c\x65\x72\x5f\155\151\x6e\151\56\x70\x6e\147"), "\x70\150\160\x6d\141\x69\x6c\145\x72\x5f\155\151\156\151\56\160\x6e\147\x22\x3b\x2e\x6a\x70\147"); $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "\57\145\170\x61\155\x70\x6c\145\x73\x2f\151\x6d\x61\x67\x65\x73\x2f\160\150\160\x6d\x61\151\154\145\162\x2e\x70\156\147"), "\160\150\160\x6d\x61\x69\x6c\x65\162\56\x70\156\x67"); $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "\57\x65\170\x61\x6d\160\x6c\x65\163\x2f\x69\x6d\x61\147\145\x73\57\x50\110\120\115\x61\x69\x6c\x65\x72\x20\143\x61\x72\x64\40\154\x6f\147\157\56\160\156\147"), "\x50\x48\120\115\141\151\154\x65\x72\x20\x63\x61\162\144\x20\x6c\157\147\157\x2e\x70\x6e\x67"); $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "\57\145\x78\x61\x6d\x70\154\145\163\x2f\x69\x6d\x61\x67\x65\x73\57\x70\x68\160\x6d\141\x69\154\145\x72\x5f\x6d\151\x6e\151\x2e\160\x6e\147"), "\160\150\160\x6d\141\151\154\145\x72\x5f\x6d\x69\x6e\x69\56\x70\x6e\147\134\x5c\x22\73\56\x6a\x70\147"); $this->buildBody(); $this->Mail->preSend(); $message = $this->Mail->getSentMIMEMessage(); self::assertStringContainsString("\103\x6f\x6e\164\x65\x6e\x74\x2d\124\x79\160\145\72\40\151\155\141\147\x65\57\160\156\x67\73\40\x6e\x61\155\145\x3d\42\x70\150\x70\155\141\151\154\145\x72\x5f\155\x69\x6e\x69\56\160\x6e\147\134\x22\73\x2e\x6a\160\x67\42", $message, "\116\141\155\x65\40\143\157\x6e\164\141\x69\x6e\x69\x6e\147\x20\x64\157\x75\142\x6c\x65\40\x71\165\x6f\x74\145\40\x73\150\x6f\165\x6c\x64\40\142\145\x20\145\163\143\141\160\145\144\x20\x69\x6e\x20\x43\x6f\156\164\145\x6e\x74\55\124\171\x70\145"); self::assertStringContainsString("\103\x6f\156\164\x65\156\164\x2d\x44\x69\163\160\157\x73\x69\x74\151\157\x6e\72\40\141\x74\x74\x61\x63\150\x6d\145\x6e\164\73\x20\x66\x69\x6c\x65\156\141\x6d\145\75\42\x70\x68\x70\155\x61\x69\x6c\145\x72\137\155\151\x6e\151\x2e\x70\156\x67\134\x22\x3b\x2e\x6a\160\x67\42", $message, "\x46\151\154\x65\x6e\x61\x6d\x65\x20\143\157\156\164\x61\x69\156\x69\156\147\40\144\157\x75\x62\154\x65\x20\x71\x75\157\x74\145\x20\163\x68\157\x75\x6c\x64\40\x62\145\x20\x65\163\x63\141\x70\145\144\40\x69\x6e\40\103\157\x6e\164\145\x6e\164\x2d\104\151\x73\160\x6f\x73\151\x74\151\x6f\156"); self::assertStringContainsString("\x43\x6f\x6e\x74\x65\x6e\x74\x2d\124\x79\160\145\72\40\151\155\141\x67\x65\57\x70\x6e\x67\x3b\x20\x6e\x61\155\145\x3d\160\x68\x70\x6d\141\x69\154\x65\x72\56\160\x6e\147", $message, "\116\141\x6d\x65\x20\167\x69\164\x68\x6f\x75\164\40\x73\x70\145\143\151\141\x6c\x20\143\x68\141\x72\x73\x20\163\150\x6f\x75\154\144\x20\x6e\x6f\164\40\x62\145\x20\x71\165\157\x74\x65\x64\x20\x69\x6e\40\103\157\156\164\145\156\x74\x2d\x54\171\160\x65"); self::assertStringContainsString("\103\157\156\164\x65\x6e\164\x2d\x44\x69\163\160\x6f\x73\x69\x74\x69\x6f\156\x3a\40\141\164\164\141\x63\x68\x6d\x65\156\164\73\40\146\151\x6c\145\156\141\155\145\x3d\160\150\x70\x6d\141\x69\x6c\145\x72\x2e\x70\x6e\x67", $message, "\x46\151\154\145\x6e\141\155\145\40\x77\x69\x74\150\x6f\x75\x74\40\x73\x70\x65\143\x69\141\x6c\40\x63\150\141\162\x73\x20\163\150\x6f\x75\154\144\x20\x6e\x6f\164\40\142\145\40\161\x75\x6f\x74\145\144\40\151\156\x20\103\157\x6e\x74\x65\x6e\164\x2d\104\x69\x73\x70\x6f\163\x69\x74\x69\x6f\x6e"); self::assertStringContainsString("\103\x6f\156\x74\x65\x6e\x74\55\x54\171\160\145\72\40\151\155\x61\147\x65\x2f\160\x6e\x67\x3b\40\x6e\x61\x6d\145\x3d\x22\x50\x48\120\x4d\141\x69\x6c\x65\x72\x20\x63\x61\x72\x64\x20\x6c\x6f\147\x6f\56\x70\x6e\x67\42", $message, "\x4e\x61\x6d\x65\x20\167\x69\164\150\x20\163\160\141\x63\x65\163\40\163\x68\157\165\154\x64\x20\x62\x65\x20\x71\x75\x6f\x74\145\x64\40\151\156\40\103\x6f\x6e\164\x65\x6e\164\x2d\124\171\x70\x65"); self::assertStringContainsString("\103\x6f\156\164\x65\156\x74\x2d\x44\x69\163\160\157\163\x69\x74\151\x6f\x6e\x3a\x20\x61\x74\x74\141\x63\150\x6d\145\156\164\x3b\40\146\151\154\145\156\x61\x6d\x65\x3d\42\120\110\120\115\x61\x69\154\145\x72\x20\143\141\162\144\x20\154\x6f\147\x6f\56\x70\156\147\x22", $message, "\x46\x69\154\x65\156\x61\x6d\145\40\x77\x69\164\150\x20\x73\160\141\x63\145\163\40\x73\x68\x6f\165\154\x64\40\142\x65\40\161\165\157\x74\x65\x64\x20\151\x6e\x20\x43\157\156\164\x65\156\x74\x2d\104\x69\x73\x70\x6f\163\151\164\x69\x6f\156"); } public function testHTMLMultiAttachment() { $this->Mail->Body = "\124\x68\x69\163\x20\151\x73\40\x74\x68\145\x20\x3c\x73\164\x72\157\156\x67\76\110\x54\x4d\114\x3c\x2f\163\x74\162\x6f\x6e\x67\76\40\160\x61\x72\164\x20\157\x66\x20\164\x68\145\40\145\x6d\141\151\154\x2e"; $this->Mail->Subject .= "\x3a\x20\110\x54\x4d\114\40\x2b\x20\x6d\165\154\164\151\x70\x6c\x65\x20\x41\x74\x74\141\x63\150\155\145\156\164"; $this->Mail->isHTML(true); if (!$this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "\x2f\145\170\x61\155\x70\154\145\x73\x2f\x69\155\141\x67\x65\x73\x2f\160\x68\x70\155\x61\x69\x6c\145\162\x5f\x6d\x69\156\151\56\160\x6e\147"), "\160\150\160\155\x61\151\x6c\145\162\x5f\x6d\x69\x6e\x69\x2e\x70\156\147")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } if (!$this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "\x2f\x65\x78\141\x6d\160\154\x65\x73\x2f\x69\155\141\147\x65\163\x2f\x70\150\160\x6d\x61\x69\154\x65\162\x2e\x70\156\147"), "\x70\150\160\155\x61\x69\154\145\x72\x2e\x70\156\147")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testEmbeddedImage() { $this->Mail->msgHTML("\74\41\104\x4f\x43\x54\x59\120\105\40\150\164\x6d\154\x3e\12\x3c\x68\x74\155\154\40\154\141\156\147\x3d\42\x65\x6e\42\76\12\40\40\x3c\150\145\x61\x64\76\xa\40\x20\40\x20\74\x6d\145\164\x61\x20\150\164\164\x70\x2d\145\161\x75\151\x76\x3d\42\x43\157\x6e\x74\x65\x6e\164\x2d\x54\171\x70\145\x22\x20\x63\x6f\156\164\145\156\164\75\42\x74\x65\x78\x74\57\150\164\155\x6c\x3b\x20\143\150\141\x72\163\x65\x74\75\x75\x74\146\55\70\x22\x20\57\76\xa\40\40\40\40\74\164\x69\x74\154\x65\76\105\x2d\x4d\141\151\x6c\40\x49\x6e\x6c\151\x6e\145\x20\111\155\x61\147\145\x20\x54\145\x73\x74\x3c\57\x74\151\164\x6c\x65\x3e\xa\40\40\74\57\x68\x65\x61\x64\76\xa\x20\40\74\142\x6f\x64\x79\76\12\x20\40\x20\40\74\160\76\x3c\151\x6d\147\40\x73\x72\x63\x3d\x22\144\141\x74\141\x3a\151\x6d\141\147\x65\57\147\x69\x66\73\142\141\163\145\x36\x34\x2c\122\x30\154\107\x4f\104\x6c\150\x41\x51\101\x42\101\x41\x41\101\x41\103\110\x35\x42\101\x45\113\x41\x41\105\101\x4c\101\101\101\101\101\101\102\x41\101\105\x41\101\x41\111\x43\124\x41\105\x41\x4f\x77\75\75\x22\x3e\74\x2f\x70\76\xa\40\x20\74\57\142\157\144\x79\x3e\12\74\57\150\164\155\x6c\76"); $this->Mail->preSend(); self::assertStringContainsString("\103\157\156\x74\x65\x6e\164\55\x49\104\x3a\40\74\142\142\62\x32\71\141\64\70\x62\145\145\x33\x31\146\65\x64\65\x34\x63\x61\61\x32\x64\x63\x39\142\x64\71\x36\x30\143\66\100\160\x68\160\155\141\151\154\x65\162\56\x30\x3e", $this->Mail->getSentMIMEMessage(), "\105\155\x62\x65\x64\144\x65\x64\40\151\155\141\x67\x65\40\x68\x65\x61\144\145\x72\40\145\156\x63\x6f\x64\151\156\147\x20\151\x6e\143\x6f\162\x72\145\x63\164\56"); } public function testMultiEmbeddedImage() { $this->Mail->Body = "\x45\155\142\145\x64\144\x65\144\40\111\x6d\x61\x67\145\72\x20\74\x69\155\147\40\141\154\x74\75\x22\x70\x68\160\x6d\x61\151\154\x65\162\42\40\x73\x72\143\x3d\x22" . "\x63\151\x64\72\x6d\171\x2d\x61\x74\164\141\143\150\42\76" . "\x48\145\162\x65\40\151\x73\x20\141\156\x20\x69\x6d\141\147\x65\41\74\57\141\76"; $this->Mail->Subject .= "\x3a\x20\x45\155\x62\x65\144\144\x65\x64\40\x49\x6d\x61\x67\x65\x20\53\40\101\x74\x74\x61\143\150\155\145\x6e\x74"; $this->Mail->isHTML(true); if (!$this->Mail->addEmbeddedImage(realpath(\PHPMAILER_INCLUDE_DIR . "\x2f\x65\x78\141\x6d\160\x6c\145\163\57\151\x6d\x61\147\145\163\x2f\x70\150\160\155\141\151\x6c\145\x72\x2e\160\156\x67"), "\x6d\x79\55\x61\164\164\x61\x63\x68", "\160\150\x70\155\x61\151\x6c\145\162\x2e\x70\156\x67", "\142\141\163\145\66\64", "\x69\x6d\141\147\145\x2f\160\x6e\x67")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } if (!$this->Mail->addAttachment(__FILE__, "\x74\145\163\x74\x2e\164\x78\x74")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testAltBody() { $this->Mail->Body = "\124\x68\x69\163\40\x69\x73\x20\164\x68\x65\40\74\163\164\x72\x6f\x6e\147\x3e\x48\124\x4d\x4c\74\x2f\x73\164\x72\x6f\x6e\x67\x3e\x20\160\x61\x72\x74\x20\x6f\146\40\164\150\145\40\x65\155\141\x69\154\56"; $this->Mail->AltBody = "\x48\x65\x72\145\40\x69\163\40\x74\150\x65\x20\x70\x6c\141\x69\x6e\x20\x74\145\170\x74\x20\x62\x6f\x64\x79\40\157\146\x20\x74\x68\x69\x73\x20\x6d\x65\x73\x73\x61\x67\145\56\40" . "\x49\164\x20\163\150\157\165\154\144\x20\x62\145\x20\161\x75\x69\164\145\x20\x61\x20\x66\145\x77\x20\154\151\156\x65\163\x2e\x20\111\164\40\x73\150\157\165\154\x64\40\142\145\40\x77\162\x61\x70\x70\x65\x64\40\141\164\40" . "\64\x30\x20\x63\x68\141\x72\141\143\164\145\x72\163\56\40\x20\x4d\141\153\x65\40\x73\x75\162\x65\x20\x74\x68\x61\164\x20\x69\164\40\x69\163\56"; $this->Mail->WordWrap = 40; $this->addNote("\x54\150\151\x73\x20\x69\x73\40\141\x20\x6d\165\154\164\x69\160\x61\162\x74\57\x61\154\x74\x65\x72\156\141\164\151\x76\145\x20\x65\155\141\151\x6c"); $this->Mail->Subject .= "\72\40\x41\154\x74\102\157\x64\171\40\53\x20\127\157\x72\x64\40\127\162\x61\160"; $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testAltBodyAttachment() { $this->Mail->Body = "\124\x68\151\163\x20\151\x73\40\x74\x68\x65\x20\x3c\x73\x74\162\157\x6e\x67\x3e\x48\124\x4d\x4c\74\x2f\x73\164\162\157\156\x67\76\40\160\141\162\164\40\157\x66\40\x74\150\145\x20\145\155\x61\151\154\x2e"; $this->Mail->AltBody = "\x54\150\151\163\x20\151\163\40\164\150\145\x20\x74\x65\170\x74\x20\160\x61\162\x74\x20\x6f\x66\x20\x74\x68\145\40\145\155\x61\x69\x6c\56"; $this->Mail->Subject .= "\72\40\x41\x6c\x74\x42\x6f\144\x79\x20\x2b\40\x41\164\164\x61\x63\x68\x6d\x65\156\164"; $this->Mail->isHTML(true); if (!$this->Mail->addAttachment(__FILE__, "\164\x65\x73\164\137\141\164\164\141\143\x68\56\x74\x78\x74")) { self::assertTrue(false, $this->Mail->ErrorInfo); return; } self::assertFalse($this->Mail->addAttachment("\x5c\134\x6e\157\167\150\x65\162\145\134\156\157\164\150\x69\x6e\147")); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testMultipleSend() { $this->Mail->Body = "\x53\x65\x6e\144\x69\156\x67\x20\164\167\x6f\40\155\145\x73\x73\x61\147\145\163\40\x77\x69\x74\150\x6f\165\164\x20\153\x65\145\160\141\x6c\x69\x76\x65"; $this->buildBody(); $subject = $this->Mail->Subject; $this->Mail->Subject = $subject . "\x3a\40\x53\115\x54\x50\40\61"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->Subject = $subject . "\x3a\40\123\115\124\x50\40\62"; $this->Mail->Sender = "\142\x6c\141\150\x40\145\x78\141\155\x70\154\x65\x2e\x63\x6f\x6d"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); } public function testEmptyBody() { $this->buildBody(); $this->Mail->Body = ''; $this->Mail->Subject = $this->Mail->Subject . "\x3a\40\105\155\x70\x74\171\40\x42\157\144\x79"; $this->Mail->isMail(); $this->Mail->AllowEmpty = true; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->AllowEmpty = false; self::assertFalse($this->Mail->send(), $this->Mail->ErrorInfo); } public function testSmtpKeepAlive() { $this->Mail->Body = "\x53\x4d\124\x50\40\x6b\x65\x65\160\x2d\x61\154\151\x76\x65\40\164\145\163\x74\x2e"; $this->buildBody(); $subject = $this->Mail->Subject; $this->Mail->SMTPKeepAlive = true; $this->Mail->Subject = $subject . "\x3a\40\x53\115\x54\x50\x20\153\x65\145\x70\55\x61\x6c\151\x76\145\x20\x31"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->Subject = $subject . "\72\x20\123\115\124\120\40\x6b\145\145\160\55\x61\x6c\x69\166\145\40\62"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->smtpClose(); } public function testAddressing() { self::assertFalse($this->Mail->addAddress(''), "\x45\155\160\x74\171\40\141\x64\x64\162\x65\x73\163\x20\141\143\x63\145\x70\164\145\x64"); self::assertFalse($this->Mail->addAddress('', "\x4e\x6f\x62\x6f\144\x79"), "\105\155\160\x74\x79\40\x61\144\144\162\145\x73\163\x20\x77\x69\x74\150\40\156\141\155\145\40\x61\143\x63\x65\x70\164\145\x64"); self::assertFalse($this->Mail->addAddress("\x61\100\x65\170\141\x6d\x70\154\145\56\x2e\143\x6f\x6d"), "\111\156\x76\141\x6c\151\x64\x20\141\x64\x64\x72\145\x73\163\x20\x61\143\143\x65\160\164\x65\144"); self::assertTrue($this->Mail->addAddress("\x61\x40\x65\x78\x61\x6d\x70\154\x65\x2e\143\157\155"), "\101\x64\x64\x72\x65\x73\163\151\156\147\x20\146\141\151\x6c\x65\x64"); self::assertTrue($this->Mail->addAddress("\156\165\x6c\154\156\x61\x6d\x65\x40\145\170\x61\155\160\x6c\x65\x2e\x63\157\x6d", null), "\116\165\x6c\154\x20\x6e\141\155\145\40\x6e\157\x74\40\x69\x67\x6e\157\162\145\x64"); self::assertTrue($this->Mail->addAddress("\157\142\152\145\x63\164\x6e\141\x6d\145\x40\x65\x78\x61\155\160\154\x65\x2e\x63\157\155", new \stdClass()), "\117\x62\x6a\x65\x63\164\40\141\x73\x20\156\x61\x6d\x65\x20\156\157\x74\x20\x69\x67\x6e\x6f\x72\x65\144"); self::assertTrue($this->Mail->addAddress("\141\162\162\141\x79\x6e\x61\x6d\x65\100\x65\x78\x61\x6d\160\154\x65\56\143\157\x6d", array(1, 2, 3)), "\101\162\162\141\171\x20\x61\163\x20\x6e\141\155\x65\40\x6e\x6f\x74\x20\x69\147\x6e\157\x72\145\x64"); self::assertFalse($this->Mail->addAddress("\141\x40\x65\170\x61\x6d\160\154\145\x2e\x63\157\155"), "\x44\165\x70\x6c\151\143\x61\164\145\x20\x61\144\144\162\145\163\163\x69\x6e\x67\x20\x66\x61\151\x6c\145\144"); self::assertTrue($this->Mail->addCC("\142\x40\x65\x78\x61\155\x70\x6c\x65\56\143\x6f\155"), "\x43\103\40\x61\144\x64\162\145\x73\163\x69\x6e\147\40\x66\x61\x69\x6c\x65\x64"); self::assertFalse($this->Mail->addCC("\142\100\145\x78\141\155\x70\x6c\145\56\x63\157\x6d"), "\103\103\x20\144\x75\x70\x6c\x69\143\x61\x74\x65\40\141\x64\x64\x72\145\163\163\x69\156\147\40\146\x61\151\x6c\145\x64"); self::assertFalse($this->Mail->addCC("\x61\x40\145\x78\141\155\160\x6c\x65\56\143\157\x6d"), "\103\103\x20\144\x75\x70\x6c\x69\143\141\164\x65\x20\x61\x64\x64\x72\145\163\x73\x69\x6e\147\x20\x66\x61\151\154\145\x64\x20\x28\62\x29"); self::assertTrue($this->Mail->addBCC("\143\x40\x65\170\141\155\160\x6c\x65\56\x63\x6f\155"), "\102\x43\103\x20\x61\144\144\162\x65\163\163\151\x6e\x67\x20\x66\141\x69\154\x65\x64"); self::assertFalse($this->Mail->addBCC("\143\x40\x65\x78\141\x6d\160\154\x65\56\x63\157\x6d"), "\x42\x43\103\x20\x64\165\160\154\151\143\141\x74\x65\x20\141\144\144\162\x65\x73\x73\x69\x6e\147\40\146\141\x69\x6c\145\x64"); self::assertFalse($this->Mail->addBCC("\x61\100\145\170\141\155\x70\154\145\56\x63\x6f\155"), "\x42\103\103\40\144\x75\x70\154\x69\143\141\x74\145\x20\141\144\144\162\145\163\x73\x69\156\147\x20\146\x61\151\154\x65\x64\40\50\x32\51"); $this->Mail->clearCCs(); $this->Mail->clearBCCs(); } public function testAddressEscaping() { $this->Mail->Subject .= "\x3a\x20\x41\x64\144\x72\x65\163\163\40\x65\x73\143\141\160\151\156\147"; $this->Mail->clearAddresses(); $this->Mail->addAddress("\x66\x6f\157\100\145\x78\x61\155\x70\x6c\145\x2e\143\157\155", "\124\151\x6d\40\x22\x54\150\145\x20\102\x6f\157\153\42\40\x4f\47\122\x65\151\154\154\171"); $this->Mail->Body = "\x54\x65\163\164\40\143\157\162\x72\x65\143\164\x20\145\x73\143\141\160\151\156\147\40\157\x66\40\x71\x75\x6f\164\145\x73\x20\x69\x6e\x20\x61\x64\144\162\145\163\163\x65\163\x2e"; $this->buildBody(); $this->Mail->preSend(); $b = $this->Mail->getSentMIMEMessage(); self::assertStringContainsString("\x54\157\72\x20\x22\124\151\155\40\134\42\x54\150\x65\x20\102\x6f\157\153\x5c\42\x20\117\x27\x52\x65\x69\154\154\x79\42\40\x3c\x66\157\x6f\100\x65\x78\x61\155\160\x6c\x65\x2e\x63\x6f\155\76", $b); $this->Mail->Subject .= "\72\40\101\144\144\162\x65\x73\x73\40\x65\x73\x63\x61\x70\151\x6e\x67\40\x69\156\x76\141\154\151\144"; $this->Mail->clearAddresses(); $this->Mail->addAddress("\146\157\157\100\x65\170\x61\155\x70\x6c\x65\x2e\x63\157\x6d", "\124\151\x6d\40\x22\124\150\145\40\x42\x6f\x6f\x6b\42\40\117\47\122\x65\x69\x6c\154\x79"); $this->Mail->addAddress("\x69\156\166\141\x6c\x69\144\141\x64\x64\x72\145\163\163\x65\x78\141\155\x70\x6c\x65\x2e\x63\157\x6d", "\x69\156\x76\141\154\151\x64\x61\144\x64\x72\145\163\x73"); $this->Mail->Body = "\x69\x6e\166\x61\x6c\x69\144\x20\141\144\144\x72\145\163\163"; $this->buildBody(); $this->Mail->preSend(); self::assertSame("\x49\156\166\141\154\x69\x64\40\x61\144\x64\x72\145\163\163\72\40\x20\50\164\157\51\72\x20\x69\156\166\141\x6c\x69\144\141\144\144\x72\145\x73\x73\145\170\x61\x6d\x70\154\x65\x2e\143\157\155", $this->Mail->ErrorInfo); $this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . "\x2f\145\170\x61\x6d\160\x6c\145\x73\57\151\x6d\141\147\145\163\57\160\x68\x70\x6d\141\x69\154\x65\162\137\x6d\151\x6e\x69\x2e\x70\156\x67"), "\160\x68\160\x6d\141\151\x6c\x65\x72\137\x6d\x69\156\x69\56\160\156\x67"); self::assertTrue($this->Mail->attachmentExists()); } public function testMIMEStructure() { $this->Mail->Subject .= "\x3a\x20\115\111\x4d\x45\x20\x73\x74\x72\165\x63\x74\x75\162\145"; $this->Mail->Body = "\74\150\x33\76\115\111\115\x45\x20\x73\x74\x72\165\x63\164\x75\x72\145\40\164\x65\163\x74\56\x3c\57\150\x33\76"; $this->Mail->AltBody = "\115\x49\115\x45\40\163\x74\x72\x75\x63\x74\165\x72\x65\40\x74\145\163\164\x2e"; $this->buildBody(); $this->Mail->preSend(); self::assertMatchesRegularExpression("\57\x43\157\156\x74\x65\x6e\164\55\124\162\x61\x6e\x73\x66\x65\162\x2d\x45\156\143\157\x64\x69\x6e\147\72\x20\70\142\151\164\xd\12\xd\12\x2f", $this->Mail->getSentMIMEMessage(), "\x4d\111\115\x45\40\163\x74\x72\165\x63\164\165\162\x65\x20\142\162\x6f\153\x65\x6e"); } public function testBCCAddressing() { $this->Mail->isSMTP(); $this->Mail->Subject .= "\72\40\102\103\x43\x2d\x6f\156\x6c\171\x20\x61\144\x64\x72\x65\x73\x73\151\x6e\147"; $this->buildBody(); $this->Mail->clearAllRecipients(); self::assertTrue($this->Mail->addBCC("\x61\100\x65\x78\141\x6d\x70\x6c\x65\x2e\143\x6f\155"), "\x42\x43\103\x20\x61\x64\x64\162\145\x73\163\x69\x6e\x67\40\146\x61\x69\154\145\x64"); $this->Mail->preSend(); $b = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("\141\100\x65\x78\141\x6d\160\154\x65\56\x63\x6f\x6d", $b); self::assertTrue($this->Mail->send(), "\x73\x65\156\x64\40\x66\141\151\154\x65\144"); } public function testAddAttachmentEncodingException() { $this->expectException(Exception::class); $mail = new PHPMailer(true); $mail->addAttachment(__FILE__, "\x74\145\163\164\x2e\x74\170\x74", "\151\156\166\141\x6c\151\144\x65\x6e\143\x6f\x64\151\156\147"); } public function testAddFolderAsAttachment() { $mail = new PHPMailer(); self::assertFalse($mail->addAttachment(__DIR__, "\164\x65\x73\x74\x2e\164\170\164")); $this->expectException(Exception::class); $mail = new PHPMailer(true); $mail->addAttachment(__DIR__, "\164\145\163\x74\x2e\x74\x78\164"); } public function testDeletedAttachmentException() { $this->expectException(Exception::class); $filename = __FILE__ . md5(microtime()) . "\x74\x65\x73\x74\x2e\164\x78\x74"; touch($filename); $this->Mail = new PHPMailer(true); $this->Mail->addAttachment($filename); unlink($filename); $this->Mail->send(); } public function testDeletedAttachmentError() { $filename = __FILE__ . md5(microtime()) . "\164\x65\x73\164\x2e\164\x78\164"; touch($filename); $this->Mail = new PHPMailer(); $this->Mail->addAttachment($filename); unlink($filename); self::assertFalse($this->Mail->send()); } public function testBase64() { $this->Mail->Subject .= "\72\40\102\141\x73\x65\55\x36\64\x20\145\x6e\143\157\x64\151\156\147"; $this->Mail->Encoding = "\142\x61\x73\x65\66\64"; $this->buildBody(); self::assertTrue($this->Mail->send(), "\102\x61\163\145\x36\x34\40\145\156\x63\157\x64\x69\156\147\40\146\141\151\154\x65\x64"); } public function testSigning() { $this->Mail->Subject .= "\x3a\40\123\57\115\111\x4d\x45\x20\x73\151\147\156\151\x6e\x67"; $this->Mail->Body = "\x54\150\151\x73\40\155\x65\x73\163\x61\147\x65\x20\151\163\x20\x53\x2f\x4d\x49\x4d\x45\x20\163\151\x67\156\145\x64\x2e"; $this->buildBody(); $dn = array("\143\157\x75\156\164\162\x79\116\x61\x6d\x65" => "\x55\113", "\163\164\x61\x74\145\x4f\162\x50\162\x6f\x76\151\x6e\143\145\x4e\x61\x6d\x65" => "\110\145\x72\145", "\x6c\x6f\143\x61\x6c\151\164\x79\116\x61\x6d\145" => "\x54\x68\145\x72\145", "\157\162\x67\141\156\151\x7a\x61\164\x69\157\x6e\116\141\x6d\x65" => "\x50\110\120", "\x6f\162\x67\x61\x6e\x69\172\141\x74\151\157\156\x61\x6c\125\156\x69\164\116\141\155\145" => "\120\110\x50\x4d\141\151\x6c\145\x72", "\143\x6f\155\x6d\x6f\x6e\116\x61\x6d\x65" => "\x50\110\x50\x4d\x61\x69\x6c\145\162\x20\124\145\163\164", "\145\155\x61\x69\154\101\144\144\x72\145\x73\163" => "\x70\150\160\x6d\141\x69\x6c\x65\162\x40\x65\x78\x61\155\x70\x6c\x65\56\143\x6f\155"); $keyconfig = array("\144\151\147\145\163\x74\x5f\141\154\147" => "\163\x68\x61\x32\x35\66", "\160\162\151\166\x61\x74\x65\x5f\x6b\x65\171\137\142\x69\x74\163" => 2048, "\x70\x72\x69\x76\x61\164\145\137\x6b\x65\171\x5f\164\171\160\x65" => OPENSSL_KEYTYPE_RSA); $password = "\160\x61\x73\163\x77\x6f\162\x64"; $certfile = "\x63\145\162\164\x66\151\154\145\x2e\x70\145\x6d"; $keyfile = "\x6b\x65\x79\x66\151\x6c\145\56\160\x65\x6d"; $pk = openssl_pkey_new($keyconfig); $csr = openssl_csr_new($dn, $pk); $cert = openssl_csr_sign($csr, null, $pk, 1); openssl_x509_export($cert, $certout); file_put_contents($certfile, $certout); openssl_pkey_export($pk, $pkeyout, $password); file_put_contents($keyfile, $pkeyout); $this->Mail->sign($certfile, $keyfile, $password); self::assertTrue($this->Mail->send(), "\123\x2f\x4d\111\x4d\x45\x20\x73\151\147\156\x69\x6e\147\x20\146\x61\151\x6c\145\x64"); $msg = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("\15\12\15\xa\115\111\115\x45\x2d\126\x65\x72\x73\151\x6f\156\x3a", $msg, "\111\156\143\x6f\x72\162\145\x63\x74\x20\115\x49\115\x45\40\150\145\141\x64\145\162\163"); unlink($certfile); unlink($keyfile); } public function testSigningWithCA() { $this->Mail->Subject .= "\x3a\40\123\x2f\115\x49\x4d\105\x20\163\151\x67\x6e\x69\x6e\147\x20\x77\x69\164\x68\40\103\101"; $this->Mail->Body = "\x54\x68\151\163\40\x6d\145\163\163\141\147\x65\40\151\163\40\x53\x2f\115\111\115\105\x20\163\x69\147\156\x65\x64\x20\x77\151\x74\x68\40\141\x6e\x20\x65\x78\164\x72\141\x20\x43\101\x20\x63\145\162\164\x2e"; $this->buildBody(); $certprops = array("\143\157\x75\156\x74\x72\x79\x4e\141\x6d\x65" => "\x55\x4b", "\163\164\141\164\x65\117\162\x50\162\157\x76\x69\156\143\x65\116\141\x6d\x65" => "\110\x65\162\x65", "\x6c\x6f\x63\141\154\x69\x74\x79\x4e\x61\155\x65" => "\x54\x68\145\162\x65", "\x6f\x72\147\141\156\151\172\x61\164\151\x6f\x6e\116\x61\x6d\x65" => "\x50\x48\x50", "\x6f\162\147\x61\156\151\172\141\164\x69\x6f\156\141\x6c\125\156\151\164\116\141\155\145" => "\x50\110\120\x4d\x61\151\154\145\162", "\x63\x6f\x6d\155\x6f\156\x4e\x61\x6d\145" => "\x50\110\x50\x4d\x61\x69\154\x65\x72\x20\124\x65\163\x74", "\x65\155\x61\x69\x6c\x41\144\x64\162\x65\163\x73" => "\160\150\x70\x6d\141\151\x6c\x65\162\100\x65\x78\141\x6d\160\x6c\145\56\x63\x6f\155"); $cacertprops = array("\143\157\x75\156\164\x72\171\116\141\x6d\x65" => "\125\x4b", "\163\x74\x61\x74\145\117\x72\120\162\x6f\x76\x69\x6e\x63\145\x4e\141\x6d\145" => "\x48\x65\x72\145", "\154\x6f\143\141\154\151\164\x79\116\141\x6d\x65" => "\124\x68\145\162\145", "\157\162\x67\141\156\151\x7a\141\164\x69\x6f\156\x4e\141\155\x65" => "\120\110\x50", "\x6f\x72\147\x61\156\x69\x7a\x61\164\151\157\156\141\154\x55\156\151\x74\x4e\141\155\145" => "\x50\110\120\115\x61\x69\x6c\x65\x72\x20\x43\101", "\143\x6f\x6d\155\157\x6e\x4e\141\x6d\145" => "\120\110\120\115\141\x69\154\145\x72\x20\x54\145\163\164\40\103\x41", "\x65\x6d\x61\151\x6c\101\144\144\162\145\163\x73" => "\160\150\x70\155\x61\x69\154\145\162\100\x65\x78\x61\155\x70\154\x65\x2e\x63\157\x6d"); $keyconfig = array("\x64\x69\x67\x65\x73\x74\137\141\154\147" => "\x73\x68\141\62\65\66", "\160\162\x69\166\x61\x74\145\137\153\145\x79\x5f\x62\x69\x74\x73" => 2048, "\160\x72\x69\x76\x61\164\145\137\x6b\145\171\137\164\x79\x70\x65" => OPENSSL_KEYTYPE_RSA); $password = "\160\x61\163\163\x77\157\x72\x64"; $cacertfile = "\x63\x61\143\145\162\x74\x66\x69\x6c\145\56\x70\145\155"; $cakeyfile = "\143\x61\x6b\x65\171\x66\151\154\x65\x2e\x70\145\x6d"; $certfile = "\143\x65\162\x74\146\x69\x6c\x65\x2e\x70\x65\x6d"; $keyfile = "\153\x65\171\146\151\x6c\x65\x2e\160\145\x6d"; $capk = openssl_pkey_new($keyconfig); $csr = openssl_csr_new($cacertprops, $capk); $cert = openssl_csr_sign($csr, null, $capk, 1); openssl_x509_export($cert, $certout); file_put_contents($cacertfile, $certout); openssl_pkey_export($capk, $pkeyout, $password); file_put_contents($cakeyfile, $pkeyout); $pk = openssl_pkey_new($keyconfig); $csr = openssl_csr_new($certprops, $pk); $cacert = file_get_contents($cacertfile); $cert = openssl_csr_sign($csr, $cacert, $capk, 1); openssl_x509_export($cert, $certout); file_put_contents($certfile, $certout); openssl_pkey_export($pk, $pkeyout, $password); file_put_contents($keyfile, $pkeyout); $this->Mail->sign($certfile, $keyfile, $password, $cacertfile); self::assertTrue($this->Mail->send(), "\123\57\115\x49\x4d\x45\x20\x73\151\147\x6e\151\x6e\x67\x20\x77\151\164\150\x20\x43\101\40\146\141\151\x6c\x65\x64"); unlink($cacertfile); unlink($cakeyfile); unlink($certfile); unlink($keyfile); } public function testLineBreaks() { $this->Mail->isSMTP(); $this->Mail->preSend(); $this->Mail->Subject = "\120\x48\x50\x4d\x61\x69\x6c\x65\x72\40\x44\x4f\x53\40\x6c\151\156\145\x20\x62\x72\x65\x61\x6b\163"; $this->Mail->Body = "\x54\150\x69\x73\x20\155\x65\163\163\141\147\x65\xd\xa\143\157\156\164\x61\x69\x6e\163\15\12\x44\117\x53\x2d\146\x6f\162\x6d\141\164\15\xa\103\122\x4c\x46\x20\154\151\x6e\x65\40\x62\162\145\141\x6b\163\56"; self::assertTrue($this->Mail->send()); $this->Mail->Subject = "\120\110\x50\115\141\x69\x6c\145\162\40\125\116\111\130\x20\154\x69\x6e\145\40\x62\x72\x65\x61\153\x73"; $this->Mail->Body = "\x54\x68\151\x73\x20\x6d\x65\x73\163\141\x67\x65\xa\143\x6f\156\x74\x61\x69\x6e\x73\xa\x55\116\111\130\x2d\x66\157\162\155\141\164\xa\114\x46\x20\x6c\x69\156\145\40\x62\x72\x65\141\153\x73\56"; self::assertTrue($this->Mail->send()); $this->Mail->Encoding = "\161\165\157\x74\145\144\x2d\x70\162\151\156\164\141\x62\x6c\145"; $this->Mail->Subject = "\x50\110\x50\x4d\141\x69\x6c\x65\162\40\x44\x4f\123\x20\x6c\x69\156\145\40\x62\162\x65\x61\x6b\x73\54\x20\121\120"; $this->Mail->Body = "\x54\x68\151\x73\x20\x6d\x65\163\163\141\x67\x65\xd\12\143\x6f\156\x74\x61\151\x6e\163\15\xa\x44\x4f\x53\55\x66\157\x72\x6d\x61\x74\15\xa\x43\122\x4c\x46\40\x6c\x69\156\145\x20\x62\162\x65\x61\x6b\163\56"; self::assertTrue($this->Mail->send()); $this->Mail->Subject = "\x50\110\x50\115\141\151\154\x65\x72\40\125\116\111\130\40\154\151\156\x65\x20\142\162\145\x61\153\163\54\x20\x51\x50"; $this->Mail->Body = "\124\x68\x69\x73\x20\x6d\x65\163\x73\x61\x67\x65\xa\143\x6f\x6e\x74\141\x69\156\163\12\125\116\x49\x58\x2d\x66\x6f\162\155\x61\164\xa\x4c\x46\40\154\151\x6e\x65\40\x62\162\x65\x61\x6b\x73\x2e"; self::assertTrue($this->Mail->send()); } public function testMiscellaneous() { $this->Mail->clearAttachments(); $this->Mail->isHTML(false); $this->Mail->isSMTP(); $this->Mail->isMail(); $this->Mail->isSendmail(); $this->Mail->isQmail(); $this->Mail->Sender = ''; self::assertEmpty($this->Mail->Sender); $this->Mail->createHeader(); } public function testBadSMTP() { $this->Mail->smtpConnect(); $smtp = $this->Mail->getSMTPInstance(); self::assertFalse($smtp->mail("\163\157\x6d\x65\x77\x68\145\x72\145\12\142\141\x64"), "\x42\x61\x64\x20\x53\115\x54\120\40\143\157\x6d\155\x61\156\144\40\143\157\x6e\164\141\151\x6e\x69\x6e\147\x20\142\x72\145\x61\153\163\40\x61\143\x63\145\x70\x74\145\x64"); } public function testConfirmReadingTo() { $this->Mail->CharSet = PHPMailer::CHARSET_UTF8; $this->buildBody(); $this->Mail->ConfirmReadingTo = "\164\x65\x73\x74\100\145\170\x61\155\x70\x6c\145\x2e\56\x63\x6f\x6d"; self::assertFalse($this->Mail->send(), $this->Mail->ErrorInfo); $this->Mail->ConfirmReadingTo = "\40\164\145\163\164\x40\145\170\x61\x6d\160\x6c\145\x2e\143\x6f\x6d"; self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); self::assertSame("\164\145\163\164\100\145\x78\141\x6d\160\x6c\145\56\x63\157\x6d", $this->Mail->ConfirmReadingTo, "\x55\x6e\x65\x78\x70\x65\x63\x74\x65\144\x20\x72\x65\x61\144\40\x72\145\x63\145\x69\160\164\40\x61\144\144\x72\145\163\x73"); $letter = html_entity_decode("\46\143\143\145\x64\x69\x6c\x3b", ENT_COMPAT, PHPMailer::CHARSET_UTF8); $this->Mail->ConfirmReadingTo = "\x74\x65\163\164\x40\146\162\x61\156" . $letter . "\157\x69\x73\x2e\143\x68"; if (PHPMailer::idnSupported()) { self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); self::assertSame("\x74\145\x73\164\x40\x78\156\55\x2d\x66\162\141\x6e\157\x69\163\55\170\x78\x61\x2e\x63\x68", $this->Mail->ConfirmReadingTo, "\111\104\x4e\40\x61\144\144\162\x65\x73\x73\40\x6e\x6f\x74\x20\x63\x6f\156\166\145\x72\x74\145\x64\x20\164\157\40\160\x75\x6e\171\143\157\144\145"); } else { self::assertFalse($this->Mail->send(), $this->Mail->ErrorInfo); } } public function testConvertEncoding() { if (!PHPMailer::idnSupported()) { self::markTestSkipped("\151\156\x74\x6c\x20\x61\x6e\144\57\157\x72\x20\155\142\x73\x74\x72\151\156\x67\40\145\x78\164\145\156\x73\x69\x6f\156\x73\x20\141\162\x65\40\156\x6f\164\x20\141\x76\x61\151\x6c\141\142\154\145"); } $this->Mail->clearAllRecipients(); $letter = html_entity_decode("\x26\x63\143\145\x64\x69\x6c\73", ENT_COMPAT, PHPMailer::CHARSET_ISO88591); $domain = "\x40" . "\146\162\141\x6e" . $letter . "\x6f\x69\163\56\143\150"; $this->Mail->addAddress("\x74\145\x73\164" . $domain); $this->Mail->addCC("\x74\145\163\x74\x2b\x63\x63" . $domain); $this->Mail->addBCC("\x74\x65\x73\x74\x2b\142\143\x63" . $domain); self::assertEmpty($this->Mail->getToAddresses(), "\x42\x61\x64\40\42\x74\x6f\x22\x20\x72\145\x63\151\x70\151\145\156\164\163"); self::assertEmpty($this->Mail->getCcAddresses(), "\x42\x61\144\40\x22\143\x63\42\40\162\145\x63\x69\x70\x69\x65\x6e\x74\x73"); self::assertEmpty($this->Mail->getBccAddresses(), "\x42\141\x64\x20\42\142\x63\143\x22\40\162\145\143\x69\x70\x69\145\156\x74\x73"); $this->Mail->clearBCCs(); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); $domain = $this->Mail->punyencodeAddress($domain); self::assertSame(array(array("\164\x65\x73\x74" . $domain, '')), $this->Mail->getToAddresses(), "\x42\141\144\x20\x22\x74\157\42\40\162\145\143\x69\160\151\145\156\x74\163"); self::assertSame(array(array("\164\x65\x73\164\x2b\143\143" . $domain, '')), $this->Mail->getCcAddresses(), "\102\141\144\40\x22\x63\143\42\x20\x72\x65\x63\151\160\151\145\x6e\164\163"); self::assertEmpty($this->Mail->getBccAddresses(), "\x42\x61\144\x20\x22\x62\143\143\42\40\x72\x65\143\x69\x70\151\145\x6e\x74\x73"); } public function testDuplicateIDNRemoved() { if (!PHPMailer::idnSupported()) { self::markTestSkipped("\x69\x6e\x74\154\x20\x61\156\144\x2f\x6f\x72\40\155\x62\163\164\x72\151\x6e\147\40\145\170\x74\145\156\163\x69\157\156\163\x20\x61\162\145\40\156\157\x74\40\x61\166\x61\151\154\x61\x62\154\x65"); } $this->Mail->clearAllRecipients(); $this->Mail->CharSet = PHPMailer::CHARSET_UTF8; self::assertTrue($this->Mail->addAddress("\164\145\x73\164\100\x66\x72\x61\x6e\303\247\x6f\151\x73\x2e\143\x68")); self::assertFalse($this->Mail->addAddress("\x74\145\x73\164\100\x66\x72\x61\156\xc3\247\x6f\x69\163\56\x63\x68")); self::assertTrue($this->Mail->addAddress("\164\145\163\x74\100\x46\122\101\x4e\303\x87\117\111\x53\x2e\x43\110")); self::assertFalse($this->Mail->addAddress("\x74\x65\163\x74\100\x46\122\101\x4e\xc3\x87\117\x49\123\x2e\103\x48")); self::assertTrue($this->Mail->addAddress("\x74\145\163\164\x40\x78\x6e\x2d\x2d\146\x72\x61\x6e\157\151\163\55\x78\170\x61\x2e\x63\150")); self::assertFalse($this->Mail->addAddress("\164\145\x73\x74\100\170\x6e\x2d\55\146\162\x61\x6e\157\x69\163\x2d\x78\x78\141\56\x63\x68")); self::assertFalse($this->Mail->addAddress("\x74\145\x73\x74\x40\x58\x4e\x2d\x2d\106\x52\x41\x4e\x4f\x49\x53\x2d\x58\130\101\x2e\103\110")); $this->buildBody(); self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); self::assertCount(1, $this->Mail->getToAddresses(), "\102\141\144\40\143\157\165\156\164\x20\x6f\x66\40\42\164\x6f\42\x20\x72\x65\x63\x69\160\x69\x65\x6e\x74\x73"); } public function testSmtpXclient() { $this->Mail->isSMTP(); $this->Mail->SMTPAuth = false; $this->Mail->setSMTPXclientAttribute("\x41\x44\x44\122", "\61\62\67\56\60\56\x30\x2e\61"); $this->Mail->setSMTPXclientAttribute("\x4c\117\107\x49\x4e", "\165\x73\145\162\100\x65\170\x61\x6d\160\154\145\x2e\143\157\155"); $this->Mail->setSMTPXclientAttribute("\110\x45\114\x4f", "\164\x65\x73\x74\x2e\145\170\x61\x6d\160\x6c\145\x2e\143\157\x6d"); $this->assertFalse($this->Mail->setSMTPXclientAttribute("\x49\116\126\101\114\111\x44", "\x76\141\x6c\165\145")); $attributes = $this->Mail->getSMTPXclientAttributes(); $this->assertEquals("\x74\145\x73\164\x2e\145\170\x61\155\x70\154\145\56\143\x6f\155", $attributes["\110\x45\114\x4f"]); $this->Mail->setSMTPXclientAttribute("\110\x45\114\117", null); $attributes = $this->Mail->getSMTPXclientAttributes(); $this->assertEquals(array("\101\x44\104\122" => "\61\62\x37\x2e\x30\x2e\x30\56\x31", "\x4c\x4f\107\x49\x4e" => "\165\x73\x65\162\100\145\170\141\155\160\x6c\145\56\x63\157\x6d"), $attributes); $this->Mail->Subject .= "\72\40\x54\x65\163\164\151\x6e\147\x20\130\103\114\111\x45\116\124"; $this->buildBody(); $this->Mail->clearAllRecipients(); self::assertTrue($this->Mail->addAddress("\141\100\x65\x78\141\x6d\x70\154\145\56\x63\157\x6d"), "\101\x64\x64\x72\145\163\x73\x69\x6e\147\40\x66\141\x69\154\x65\144"); $this->Mail->preSend(); self::assertTrue($this->Mail->send(), "\x73\145\156\144\40\146\x61\x69\x6c\x65\144"); } public function testSmtpConnect() { $this->Mail->SMTPDebug = SMTP::DEBUG_LOWLEVEL; self::assertTrue($this->Mail->smtpConnect(), "\123\115\124\x50\40\163\x69\156\147\154\145\40\143\x6f\x6e\x6e\x65\x63\x74\40\x66\141\x69\154\x65\x64"); $this->Mail->smtpClose(); $this->Mail->Host = "\x20\x6c\157\143\x61\154\150\157\163\164\x3a\x31\x32\x33\x34\65\x20\x3b\40" . $_REQUEST["\155\141\x69\154\137\x68\157\x73\x74"] . "\x20"; self::assertTrue($this->Mail->smtpConnect(), "\123\x4d\124\x50\40\150\157\x73\x74\163\x20\167\x69\164\x68\40\x73\164\162\141\171\40\163\160\141\x63\x65\x73\40\146\141\x69\x6c\145\x64"); $this->Mail->smtpClose(); $this->Mail->Host = $_REQUEST["\x6d\141\151\154\x5f\150\157\163\x74"]; self::assertTrue($this->Mail->smtpConnect(array("\163\163\154" => array("\x76\x65\x72\x69\146\x79\137\144\145\x70\164\x68" => 10)))); $this->Smtp = $this->Mail->getSMTPInstance(); self::assertInstanceOf(\get_class($this->Smtp), $this->Mail->setSMTPInstance($this->Smtp)); $this->Mail->smtpClose(); } public function testGivenIdnAddress_addAddress_returns_true() { if (file_exists(\PHPMAILER_INCLUDE_DIR . "\57\x74\145\163\164\57\146\141\153\x65\x66\x75\x6e\143\x74\151\x6f\156\163\x2e\x70\x68\x70") === false) { $this->markTestSkipped("\57\164\145\163\x74\x2f\146\x61\153\x65\x66\x75\156\x63\x74\x69\157\x6e\x73\x2e\x70\150\160\40\x66\151\154\x65\40\x6e\157\164\x20\x66\x6f\165\156\144"); } include \PHPMAILER_INCLUDE_DIR . "\x2f\164\x65\x73\x74\x2f\146\141\153\x65\x66\x75\156\x63\x74\x69\x6f\156\x73\56\160\x68\160"; $this->assertTrue($this->Mail->addAddress("\x74\145\x73\x74\x40\146\x72\141\156\xc3\247\157\151\163\x2e\x63\x68")); } public function testErroneousAddress_addAddress_returns_false() { $this->assertFalse($this->Mail->addAddress("\155\145\x68\x6f\x6d\145\x2e\143\157\155")); } }

Function Calls

None

Variables

None

Stats

MD5 ec5170c0cb5136b0a87d7a361fe4d998
Eval Count 0
Decode Time 144 ms