1cc92aca7SAndreas Gohr<?php 2cc92aca7SAndreas Gohr 3*198564abSMichael Großeuse dokuwiki\HTTPClient\HTTPClient; 4*198564abSMichael Große 5cc92aca7SAndreas Gohr/** 6cc92aca7SAndreas Gohr * Extends the mailer class to expose internal variables for testing 7cc92aca7SAndreas Gohr */ 8cc92aca7SAndreas Gohrclass TestMailer extends Mailer { 9cc92aca7SAndreas Gohr public function prop($name){ 10cc92aca7SAndreas Gohr return $this->$name; 11cc92aca7SAndreas Gohr } 121f61f312SDominik Eckelmann 131f61f312SDominik Eckelmann public function &propRef($name) { 141f61f312SDominik Eckelmann return $this->$name; 151f61f312SDominik Eckelmann } 161f61f312SDominik Eckelmann 171f61f312SDominik Eckelmann public function prepareHeaders() { 181f61f312SDominik Eckelmann return parent::prepareHeaders(); 191f61f312SDominik Eckelmann } 20b6c97c70SAndreas Gohr 21b6c97c70SAndreas Gohr public function cleanHeaders() { 22b6c97c70SAndreas Gohr parent::cleanHeaders(); 23b6c97c70SAndreas Gohr } 24b6c97c70SAndreas Gohr 25cc92aca7SAndreas Gohr} 26cc92aca7SAndreas Gohr 27cc92aca7SAndreas Gohrclass mailer_test extends DokuWikiTest { 28cc92aca7SAndreas Gohr 29cc92aca7SAndreas Gohr 30cc92aca7SAndreas Gohr function test_userheader(){ 31cc92aca7SAndreas Gohr $mail = new TestMailer(); 32cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 33cc92aca7SAndreas Gohr $this->assertArrayNotHasKey('X-Dokuwiki-User',$headers); 34cc92aca7SAndreas Gohr 35cc92aca7SAndreas Gohr $_SERVER['REMOTE_USER'] = 'andi'; 36cc92aca7SAndreas Gohr $mail = new TestMailer(); 37cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 38cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Dokuwiki-User',$headers); 39cc92aca7SAndreas Gohr } 40cc92aca7SAndreas Gohr 41cc92aca7SAndreas Gohr function test_setHeader(){ 42cc92aca7SAndreas Gohr $mail = new TestMailer(); 43cc92aca7SAndreas Gohr 44cc92aca7SAndreas Gohr // check existance of default headers 45cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 46cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Mailer',$headers); 47cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Dokuwiki-Title',$headers); 48cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Dokuwiki-Server',$headers); 49cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Auto-Response-Suppress',$headers); 50cc92aca7SAndreas Gohr $this->assertArrayHasKey('List-Id',$headers); 51cc92aca7SAndreas Gohr 52cc92aca7SAndreas Gohr // set a bunch of test headers 53cc92aca7SAndreas Gohr $mail->setHeader('test-header','bla'); 54cc92aca7SAndreas Gohr $mail->setHeader('to','A valid ASCII name <test@example.com>'); 55c8d2e830SChristopher Smith $mail->setHeader('from',"Thös ne\needs\x00serious cleaning\$§%."); 56c8d2e830SChristopher Smith $mail->setHeader('bad',"Thös ne\needs\x00serious cleaning\$§%.",false); 57cc92aca7SAndreas Gohr $mail->setHeader("weird\n*+\x00foo.-_@bar?",'now clean'); 58cc92aca7SAndreas Gohr 59cc92aca7SAndreas Gohr // are they set? 60cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 61cc92aca7SAndreas Gohr $this->assertArrayHasKey('Test-Header',$headers); 62cc92aca7SAndreas Gohr $this->assertEquals('bla',$headers['Test-Header']); 63cc92aca7SAndreas Gohr $this->assertArrayHasKey('To',$headers); 64cc92aca7SAndreas Gohr $this->assertEquals('A valid ASCII name <test@example.com>',$headers['To']); 65cc92aca7SAndreas Gohr $this->assertArrayHasKey('From',$headers); 66cc92aca7SAndreas Gohr $this->assertEquals('Ths neeedsserious cleaning.',$headers['From']); 67cc92aca7SAndreas Gohr $this->assertArrayHasKey('Bad',$headers); 68d1612d99SAndreas Gohr $this->assertEquals("Thös ne\needs\x00serious cleaning\$§%.",$headers['Bad']); 69cc92aca7SAndreas Gohr $this->assertArrayHasKey('Weird+foo.-_@bar',$headers); 70cc92aca7SAndreas Gohr 71cc92aca7SAndreas Gohr // unset a header again 72cc92aca7SAndreas Gohr $mail->setHeader('test-header',''); 73cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 74cc92aca7SAndreas Gohr $this->assertArrayNotHasKey('Test-Header',$headers); 75cc92aca7SAndreas Gohr } 76cc92aca7SAndreas Gohr 77b6c97c70SAndreas Gohr function test_addresses(){ 781d7c1f1bSYurii K if (isWindows()) { 791d7c1f1bSYurii K $this->markTestSkipped(); 801d7c1f1bSYurii K } 811d7c1f1bSYurii K 82b6c97c70SAndreas Gohr $mail = new TestMailer(); 83b6c97c70SAndreas Gohr 84b6c97c70SAndreas Gohr $mail->to('andi@splitbrain.org'); 85b6c97c70SAndreas Gohr $mail->cleanHeaders(); 86b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 87b6c97c70SAndreas Gohr $this->assertEquals('andi@splitbrain.org', $headers['To']); 88b6c97c70SAndreas Gohr 89b6c97c70SAndreas Gohr $mail->to('<andi@splitbrain.org>'); 90b6c97c70SAndreas Gohr $mail->cleanHeaders(); 91b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 92b6c97c70SAndreas Gohr $this->assertEquals('andi@splitbrain.org', $headers['To']); 93b6c97c70SAndreas Gohr 94b6c97c70SAndreas Gohr $mail->to('Andreas Gohr <andi@splitbrain.org>'); 95b6c97c70SAndreas Gohr $mail->cleanHeaders(); 96b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 97b6c97c70SAndreas Gohr $this->assertEquals('Andreas Gohr <andi@splitbrain.org>', $headers['To']); 98b6c97c70SAndreas Gohr 99b6c97c70SAndreas Gohr $mail->to('Andreas Gohr <andi@splitbrain.org> , foo <foo@example.com>'); 100b6c97c70SAndreas Gohr $mail->cleanHeaders(); 101b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 102b6c97c70SAndreas Gohr $this->assertEquals('Andreas Gohr <andi@splitbrain.org>, foo <foo@example.com>', $headers['To']); 103b6c97c70SAndreas Gohr 104b6c97c70SAndreas Gohr $mail->to('Möp <moep@example.com> , foo <foo@example.com>'); 105b6c97c70SAndreas Gohr $mail->cleanHeaders(); 106b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 107b6c97c70SAndreas Gohr $this->assertEquals('=?UTF-8?B?TcO2cA==?= <moep@example.com>, foo <foo@example.com>', $headers['To']); 108b6c97c70SAndreas Gohr 109b6c97c70SAndreas Gohr $mail->to(array('Möp <moep@example.com> ',' foo <foo@example.com>')); 110b6c97c70SAndreas Gohr $mail->cleanHeaders(); 111b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 112b6c97c70SAndreas Gohr $this->assertEquals('=?UTF-8?B?TcO2cA==?= <moep@example.com>, foo <foo@example.com>', $headers['To']); 113b6c97c70SAndreas Gohr 114b6c97c70SAndreas Gohr $mail->to(array('Beet, L van <lvb@example.com>',' foo <foo@example.com>')); 115b6c97c70SAndreas Gohr $mail->cleanHeaders(); 116b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 117b6c97c70SAndreas Gohr $this->assertEquals('=?UTF-8?B?QmVldCwgTCB2YW4=?= <lvb@example.com>, foo <foo@example.com>', $headers['To']); 118b6c97c70SAndreas Gohr 119b6c97c70SAndreas Gohr 120b6c97c70SAndreas Gohr } 121b6c97c70SAndreas Gohr 122cc92aca7SAndreas Gohr function test_simplemail(){ 123cc92aca7SAndreas Gohr global $conf; 124cc92aca7SAndreas Gohr $conf['htmlmail'] = 0; 1259ea45836SChristopher Smith 1269ea45836SChristopher Smith $mailbody = 'A test mail in ASCII'; 127cc92aca7SAndreas Gohr $mail = new TestMailer(); 128cc92aca7SAndreas Gohr $mail->to('test@example.com'); 1299ea45836SChristopher Smith $mail->setBody($mailbody); 130cc92aca7SAndreas Gohr 131cc92aca7SAndreas Gohr $dump = $mail->dump(); 1329ea45836SChristopher Smith 1339ea45836SChristopher Smith // construct the expected mail body text - include the expected dokuwiki signature 1349ea45836SChristopher Smith $replacements = $mail->prop('replacements'); 1359ea45836SChristopher Smith $expected_mail_body = chunk_split(base64_encode($mailbody.$replacements['text']['EMAILSIGNATURE']),72,MAILHEADER_EOL); 1369ea45836SChristopher Smith 137cc92aca7SAndreas Gohr $this->assertNotRegexp('/Content-Type: multipart/',$dump); 138cc92aca7SAndreas Gohr $this->assertRegexp('#Content-Type: text/plain; charset=UTF-8#',$dump); 1399ea45836SChristopher Smith $this->assertRegexp('/'.preg_quote($expected_mail_body,'/').'/',$dump); 140cc92aca7SAndreas Gohr 141cc92aca7SAndreas Gohr $conf['htmlmail'] = 1; 142cc92aca7SAndreas Gohr } 143cc92aca7SAndreas Gohr 144cc92aca7SAndreas Gohr function test_replacements(){ 145cc92aca7SAndreas Gohr $mail = new TestMailer(); 146cc92aca7SAndreas Gohr 1479e01e280SChristopher Smith $replacements = array( '@DATE@','@BROWSER@','@IPADDRESS@','@HOSTNAME@','@EMAILSIGNATURE@', 148cc92aca7SAndreas Gohr '@TITLE@','@DOKUWIKIURL@','@USER@','@NAME@','@MAIL@'); 149cc92aca7SAndreas Gohr $mail->setBody('A test mail in with replacements '.join(' ',$replacements)); 150cc92aca7SAndreas Gohr 151cc92aca7SAndreas Gohr $text = $mail->prop('text'); 152cc92aca7SAndreas Gohr $html = $mail->prop('html'); 153cc92aca7SAndreas Gohr 154cc92aca7SAndreas Gohr foreach($replacements as $repl){ 155cc92aca7SAndreas Gohr $this->assertNotRegexp("/$repl/",$text,"$repl replacement still in text"); 156cc92aca7SAndreas Gohr $this->assertNotRegexp("/$repl/",$html,"$repl replacement still in html"); 157cc92aca7SAndreas Gohr } 158cc92aca7SAndreas Gohr } 159cc92aca7SAndreas Gohr 16091effd8dSDominik Eckelmann /** 16191effd8dSDominik Eckelmann * @see https://forum.dokuwiki.org/post/35822 16291effd8dSDominik Eckelmann */ 1631f61f312SDominik Eckelmann function test_emptyBCCorCC() { 1641f61f312SDominik Eckelmann $mail = new TestMailer(); 1651f61f312SDominik Eckelmann $headers = &$mail->propRef('headers'); 1661f61f312SDominik Eckelmann $headers['Bcc'] = ''; 1671f61f312SDominik Eckelmann $headers['Cc'] = ''; 1681f61f312SDominik Eckelmann $header = $mail->prepareHeaders(); 1691f61f312SDominik Eckelmann $this->assertEquals(0, preg_match('/(^|\n)Bcc: (\n|$)/', $header), 'Bcc found in headers.'); 1706be717dbSMichael Hamann $this->assertEquals(0, preg_match('/(^|\n)Cc: (\n|$)/', $header), 'Cc found in headers.'); 1716be717dbSMichael Hamann } 1726be717dbSMichael Hamann 1736be717dbSMichael Hamann function test_nullTOorCCorBCC() { 1746be717dbSMichael Hamann $mail = new TestMailer(); 1756be717dbSMichael Hamann $headers = &$mail->propRef('headers'); 1766be717dbSMichael Hamann $headers['Bcc'] = NULL; 1776be717dbSMichael Hamann $headers['Cc'] = NULL; 1786be717dbSMichael Hamann $headers['To'] = NULL; 1796be717dbSMichael Hamann $header = $mail->prepareHeaders(); 1806be717dbSMichael Hamann $this->assertEquals(0, preg_match('/(^|\n)Bcc: (\n|$)/', $header), 'Bcc found in headers.'); 1816be717dbSMichael Hamann $this->assertEquals(0, preg_match('/(^|\n)Cc: (\n|$)/', $header), 'Cc found in headers.'); 1826be717dbSMichael Hamann $this->assertEquals(0, preg_match('/(^|\n)To: (\n|$)/', $header), 'To found in headers.'); 1831f61f312SDominik Eckelmann } 1840ee5ed1eSAndreas Gohr 1850ee5ed1eSAndreas Gohr /** 1860ee5ed1eSAndreas Gohr * @group internet 1870ee5ed1eSAndreas Gohr */ 1880ee5ed1eSAndreas Gohr function test_lint(){ 1890ee5ed1eSAndreas Gohr // prepare a simple multipart message 1900ee5ed1eSAndreas Gohr $mail = new TestMailer(); 1910ee5ed1eSAndreas Gohr $mail->to(array('Möp <moep@example.com> ',' foo <foo@example.com>')); 192d6e04b60SAndreas Gohr $mail->from('Me <test@example.com>'); 1930ee5ed1eSAndreas Gohr $mail->subject('This is a töst'); 1940ee5ed1eSAndreas Gohr $mail->setBody('Hello Wörld, 1950ee5ed1eSAndreas Gohr 1960ee5ed1eSAndreas Gohr please don\'t burn, okay? 1970ee5ed1eSAndreas Gohr '); 198ec82d005SAndreas Gohr $mail->attachContent('some test data', 'text/plain', 'a text.txt'); 1990ee5ed1eSAndreas Gohr $msg = $mail->dump(); 2000ee5ed1eSAndreas Gohr $msglines = explode("\n", $msg); 2010ee5ed1eSAndreas Gohr 202d6e04b60SAndreas Gohr //echo $msg; 203d6e04b60SAndreas Gohr 2040ee5ed1eSAndreas Gohr // ask message lint if it is okay 2050ee5ed1eSAndreas Gohr $html = new HTTPClient(); 2067468fb90SAndreas Gohr $results = $html->post('https://tools.ietf.org/tools/msglint/msglint', array('msg'=>$msg)); 20795e6ded1SAndreas Gohr if($results === false) { 20895e6ded1SAndreas Gohr $this->markTestSkipped('no response from validator'); 20995e6ded1SAndreas Gohr return; 21095e6ded1SAndreas Gohr } 2110ee5ed1eSAndreas Gohr 2120ee5ed1eSAndreas Gohr // parse the result lines 2130ee5ed1eSAndreas Gohr $lines = explode("\n", $results); 2140ee5ed1eSAndreas Gohr $rows = count($lines); 2150ee5ed1eSAndreas Gohr $i=0; 2160ee5ed1eSAndreas Gohr while(trim($lines[$i]) != '-----------' && $i<$rows) $i++; //skip preamble 2170ee5ed1eSAndreas Gohr for($i=$i+1; $i<$rows; $i++){ 2180ee5ed1eSAndreas Gohr $line = trim($lines[$i]); 2190ee5ed1eSAndreas Gohr if($line == '-----------') break; //skip appendix 2200ee5ed1eSAndreas Gohr 2210ee5ed1eSAndreas Gohr // get possible continuation of the line 2220ee5ed1eSAndreas Gohr while($lines[$i+1][0] == ' '){ 2230ee5ed1eSAndreas Gohr $line .= ' '.trim($lines[$i+1]); 2240ee5ed1eSAndreas Gohr $i++; 2250ee5ed1eSAndreas Gohr } 2260ee5ed1eSAndreas Gohr 2270ee5ed1eSAndreas Gohr // check the line for errors 228ec82d005SAndreas Gohr if(substr($line,0,5) == 'ERROR' || substr($line,0,7) == 'WARNING'){ 229d6e04b60SAndreas Gohr // ignore some errors 230d6e04b60SAndreas Gohr if(strpos($line, "missing mandatory header 'return-path'")) continue; #set by MDA 231acb389a8SAndreas Gohr if(strpos($line, "bare newline in text body decoded")) continue; #we don't send mail bodies as CRLF, yet 232acb389a8SAndreas Gohr if(strpos($line, "last decoded line too long")) continue; #we don't send mail bodies as CRLF, yet 233d6e04b60SAndreas Gohr 2340ee5ed1eSAndreas Gohr // get the context in which the error occured 2350ee5ed1eSAndreas Gohr $errorin = ''; 2360ee5ed1eSAndreas Gohr if(preg_match('/line (\d+)$/', $line, $m)){ 2370ee5ed1eSAndreas Gohr $errorin .= "\n".$msglines[$m[1] - 1]; 2380ee5ed1eSAndreas Gohr } 2390ee5ed1eSAndreas Gohr if(preg_match('/lines (\d+)-(\d+)$/', $line, $m)){ 2400ee5ed1eSAndreas Gohr for($x=$m[1]-1; $x<$m[2]; $x++){ 2410ee5ed1eSAndreas Gohr $errorin .= "\n".$msglines[$x]; 2420ee5ed1eSAndreas Gohr } 2430ee5ed1eSAndreas Gohr } 2440ee5ed1eSAndreas Gohr 2450ee5ed1eSAndreas Gohr // raise the error 2460ee5ed1eSAndreas Gohr throw new Exception($line.$errorin); 2470ee5ed1eSAndreas Gohr } 2480ee5ed1eSAndreas Gohr } 2490ee5ed1eSAndreas Gohr 2501bff2abaSAndreas Gohr $this->assertTrue(true); // avoid being marked as risky for having no assertion 2510ee5ed1eSAndreas Gohr } 252774514c9SGerrit Uitslag 253774514c9SGerrit Uitslag function test_simplemailsignature() { 254774514c9SGerrit Uitslag global $conf; 255774514c9SGerrit Uitslag $conf['htmlmail'] = 0; 256774514c9SGerrit Uitslag 257774514c9SGerrit Uitslag $mailbody = 'A test mail in ASCII'; 258774514c9SGerrit Uitslag $signature = "\n-- \n" . 'This mail was generated by DokuWiki at' . "\n" . DOKU_URL . "\n"; 259774514c9SGerrit Uitslag $mail = new TestMailer(); 260774514c9SGerrit Uitslag $mail->to('test@example.com'); 261774514c9SGerrit Uitslag $mail->setBody($mailbody); 262774514c9SGerrit Uitslag 263774514c9SGerrit Uitslag $dump = $mail->dump(); 264774514c9SGerrit Uitslag 265774514c9SGerrit Uitslag // construct the expected mail body text - include the expected dokuwiki signature 266774514c9SGerrit Uitslag $expected_mail_body = chunk_split(base64_encode($mailbody . $signature), 72, MAILHEADER_EOL); 267774514c9SGerrit Uitslag $this->assertRegexp('/' . preg_quote($expected_mail_body, '/') . '/', $dump); 268774514c9SGerrit Uitslag 269774514c9SGerrit Uitslag $conf['htmlmail'] = 1; 270774514c9SGerrit Uitslag } 271774514c9SGerrit Uitslag 272774514c9SGerrit Uitslag function test_htmlmailsignature() { 273774514c9SGerrit Uitslag $mailbody_text = 'A test mail in ASCII :)'; 274774514c9SGerrit Uitslag $mailbody_html = 'A test mail in <strong>html</strong>'; 275774514c9SGerrit Uitslag $htmlmsg_expected = '<html> 276774514c9SGerrit Uitslag<head> 277774514c9SGerrit Uitslag <title>My Test Wiki</title> 278774514c9SGerrit Uitslag <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 279774514c9SGerrit Uitslag</head> 280774514c9SGerrit Uitslag<body> 281774514c9SGerrit Uitslag 282774514c9SGerrit UitslagA test mail in <strong>html</strong> 283774514c9SGerrit Uitslag 284774514c9SGerrit Uitslag<br /><hr /> 285f3cd98a0SGerrit Uitslag<small>This mail was generated by DokuWiki at<br /><a href="' . DOKU_URL . '">' . DOKU_URL . '</a></small> 286774514c9SGerrit Uitslag</body> 287774514c9SGerrit Uitslag</html> 288774514c9SGerrit Uitslag'; 289774514c9SGerrit Uitslag 290774514c9SGerrit Uitslag $mail = new TestMailer(); 291774514c9SGerrit Uitslag $mail->to('test@example.com'); 292774514c9SGerrit Uitslag $mail->setBody($mailbody_text, null, null, $mailbody_html); 293774514c9SGerrit Uitslag 294774514c9SGerrit Uitslag $dump = $mail->dump(); 295774514c9SGerrit Uitslag 296774514c9SGerrit Uitslag // construct the expected mail body text - include the expected dokuwiki signature 297774514c9SGerrit Uitslag $expected_mail_body = chunk_split(base64_encode($htmlmsg_expected), 72, MAILHEADER_EOL); 298774514c9SGerrit Uitslag 299774514c9SGerrit Uitslag $this->assertRegexp('/Content-Type: multipart/', $dump); 300774514c9SGerrit Uitslag $this->assertRegexp('#Content-Type: text/plain; charset=UTF-8#', $dump); 301774514c9SGerrit Uitslag $this->assertRegexp('/' . preg_quote($expected_mail_body, '/') . '/', $dump); 302774514c9SGerrit Uitslag 303774514c9SGerrit Uitslag } 304774514c9SGerrit Uitslag 305774514c9SGerrit Uitslag function test_htmlmailsignaturecustom() { 306774514c9SGerrit Uitslag global $lang; 307774514c9SGerrit Uitslag $lang['email_signature_html'] = 'Official message from your DokuWiki @DOKUWIKIURL@<br />Created by wonderful mail class <a href="https://www.dokuwiki.org/devel:mail">https://www.dokuwiki.org/devel:mail</a>'; 308774514c9SGerrit Uitslag 309774514c9SGerrit Uitslag $mailbody_text = 'A test mail in ASCII :)'; 310774514c9SGerrit Uitslag $mailbody_html = 'A test mail in <strong>html</strong>'; 311774514c9SGerrit Uitslag $htmlmsg_expected = '<html> 312774514c9SGerrit Uitslag<head> 313774514c9SGerrit Uitslag <title>My Test Wiki</title> 314774514c9SGerrit Uitslag <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 315774514c9SGerrit Uitslag</head> 316774514c9SGerrit Uitslag<body> 317774514c9SGerrit Uitslag 318774514c9SGerrit UitslagA test mail in <strong>html</strong> 319774514c9SGerrit Uitslag 320774514c9SGerrit Uitslag<br /><hr /> 321f3cd98a0SGerrit Uitslag<small>Official message from your DokuWiki <a href="' . DOKU_URL . '">' . DOKU_URL . '</a><br />Created by wonderful mail class <a href="https://www.dokuwiki.org/devel:mail">https://www.dokuwiki.org/devel:mail</a></small> 322774514c9SGerrit Uitslag</body> 323774514c9SGerrit Uitslag</html> 324774514c9SGerrit Uitslag'; 325774514c9SGerrit Uitslag 326774514c9SGerrit Uitslag $mail = new TestMailer(); 327774514c9SGerrit Uitslag $mail->to('test@example.com'); 328774514c9SGerrit Uitslag $mail->setBody($mailbody_text, null, null, $mailbody_html); 329774514c9SGerrit Uitslag 330774514c9SGerrit Uitslag $dump = $mail->dump(); 331774514c9SGerrit Uitslag 332774514c9SGerrit Uitslag // construct the expected mail body text - include the expected dokuwiki signature 333774514c9SGerrit Uitslag $replacements = $mail->prop('replacements'); 334774514c9SGerrit Uitslag $expected_mail_body = chunk_split(base64_encode($htmlmsg_expected), 72, MAILHEADER_EOL); 335774514c9SGerrit Uitslag 336774514c9SGerrit Uitslag $this->assertRegexp('/' . preg_quote($expected_mail_body, '/') . '/', $dump); 337774514c9SGerrit Uitslag 338774514c9SGerrit Uitslag } 339cc92aca7SAndreas Gohr} 340cc92aca7SAndreas Gohr//Setup VIM: ex: et ts=4 : 341