diff --git a/tests/phpunit/tests/mail.php b/tests/phpunit/tests/mail.php index 547ed99..d7d5abf 100644 --- a/tests/phpunit/tests/mail.php +++ b/tests/phpunit/tests/mail.php @@ -72,6 +72,40 @@ class Tests_Mail extends WP_UnitTestCase { } /** + * @ticket 15448 + */ + function test_wp_mail_plain_and_html() { + $to = 'user@example.com'; + $subject = 'Test email with plain text and html versions'; + $messages = array( 'text/plain' => 'Here is some plain text.', + 'text/html' =>'Here is the HTML ;-)' ); + + wp_mail( $to, $subject, $messages ); + + preg_match( '/boundary="(.*)"/', $GLOBALS['phpmailer']->mock_sent[0]['header'], $matches); + $boundry = $matches[1]; + $body = '--' . $boundry . ' +Content-Type: text/plain; charset = "UTF-8" +Content-Transfer-Encoding: 8bit + +Here is some plain text. + + +--' . $boundry . ' +Content-Type: text/html; charset = "UTF-8" +Content-Transfer-Encoding: 8bit + +Here is the HTML ;-) + + + +--' . $boundry . '-- +'; + // We need some better assertions here but these test the behaviour for now. + $this->assertEquals($body, $GLOBALS['phpmailer']->mock_sent[0]['body']); + } + + /** * @ticket 17305 */ function test_wp_mail_rfc2822_addresses() {