1cc92aca7SAndreas Gohr<?php 2cc92aca7SAndreas Gohr 3cc92aca7SAndreas Gohr/** 4cc92aca7SAndreas Gohr * Extends the mailer class to expose internal variables for testing 5cc92aca7SAndreas Gohr */ 6cc92aca7SAndreas Gohrclass TestMailer extends Mailer { 7cc92aca7SAndreas Gohr public function prop($name){ 8cc92aca7SAndreas Gohr return $this->$name; 9cc92aca7SAndreas Gohr } 101f61f312SDominik Eckelmann 111f61f312SDominik Eckelmann public function &propRef($name) { 121f61f312SDominik Eckelmann return $this->$name; 131f61f312SDominik Eckelmann } 141f61f312SDominik Eckelmann 151f61f312SDominik Eckelmann public function prepareHeaders() { 161f61f312SDominik Eckelmann return parent::prepareHeaders(); 171f61f312SDominik Eckelmann } 18b6c97c70SAndreas Gohr 19b6c97c70SAndreas Gohr public function cleanHeaders() { 20b6c97c70SAndreas Gohr parent::cleanHeaders(); 21b6c97c70SAndreas Gohr } 22b6c97c70SAndreas Gohr 23cc92aca7SAndreas Gohr} 24cc92aca7SAndreas Gohr 25cc92aca7SAndreas Gohrclass mailer_test extends DokuWikiTest { 26cc92aca7SAndreas Gohr 27cc92aca7SAndreas Gohr 28cc92aca7SAndreas Gohr function test_userheader(){ 29cc92aca7SAndreas Gohr $mail = new TestMailer(); 30cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 31cc92aca7SAndreas Gohr $this->assertArrayNotHasKey('X-Dokuwiki-User',$headers); 32cc92aca7SAndreas Gohr 33cc92aca7SAndreas Gohr $_SERVER['REMOTE_USER'] = 'andi'; 34cc92aca7SAndreas Gohr $mail = new TestMailer(); 35cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 36cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Dokuwiki-User',$headers); 37cc92aca7SAndreas Gohr } 38cc92aca7SAndreas Gohr 39cc92aca7SAndreas Gohr function test_setHeader(){ 40cc92aca7SAndreas Gohr $mail = new TestMailer(); 41cc92aca7SAndreas Gohr 42cc92aca7SAndreas Gohr // check existance of default headers 43cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 44cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Mailer',$headers); 45cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Dokuwiki-Title',$headers); 46cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Dokuwiki-Server',$headers); 47cc92aca7SAndreas Gohr $this->assertArrayHasKey('X-Auto-Response-Suppress',$headers); 48cc92aca7SAndreas Gohr $this->assertArrayHasKey('List-Id',$headers); 49cc92aca7SAndreas Gohr 50cc92aca7SAndreas Gohr // set a bunch of test headers 51cc92aca7SAndreas Gohr $mail->setHeader('test-header','bla'); 52cc92aca7SAndreas Gohr $mail->setHeader('to','A valid ASCII name <test@example.com>'); 53c8d2e830SChristopher Smith $mail->setHeader('from',"Thös ne\needs\x00serious cleaning\$§%."); 54c8d2e830SChristopher Smith $mail->setHeader('bad',"Thös ne\needs\x00serious cleaning\$§%.",false); 55cc92aca7SAndreas Gohr $mail->setHeader("weird\n*+\x00foo.-_@bar?",'now clean'); 56cc92aca7SAndreas Gohr 57cc92aca7SAndreas Gohr // are they set? 58cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 59cc92aca7SAndreas Gohr $this->assertArrayHasKey('Test-Header',$headers); 60cc92aca7SAndreas Gohr $this->assertEquals('bla',$headers['Test-Header']); 61cc92aca7SAndreas Gohr $this->assertArrayHasKey('To',$headers); 62cc92aca7SAndreas Gohr $this->assertEquals('A valid ASCII name <test@example.com>',$headers['To']); 63cc92aca7SAndreas Gohr $this->assertArrayHasKey('From',$headers); 64cc92aca7SAndreas Gohr $this->assertEquals('Ths neeedsserious cleaning.',$headers['From']); 65cc92aca7SAndreas Gohr $this->assertArrayHasKey('Bad',$headers); 66d1612d99SAndreas Gohr $this->assertEquals("Thös ne\needs\x00serious cleaning\$§%.",$headers['Bad']); 67cc92aca7SAndreas Gohr $this->assertArrayHasKey('Weird+foo.-_@bar',$headers); 68cc92aca7SAndreas Gohr 69cc92aca7SAndreas Gohr // unset a header again 70cc92aca7SAndreas Gohr $mail->setHeader('test-header',''); 71cc92aca7SAndreas Gohr $headers = $mail->prop('headers'); 72cc92aca7SAndreas Gohr $this->assertArrayNotHasKey('Test-Header',$headers); 73cc92aca7SAndreas Gohr } 74cc92aca7SAndreas Gohr 75b6c97c70SAndreas Gohr function test_addresses(){ 76b6c97c70SAndreas Gohr $mail = new TestMailer(); 77b6c97c70SAndreas Gohr 78b6c97c70SAndreas Gohr $mail->to('andi@splitbrain.org'); 79b6c97c70SAndreas Gohr $mail->cleanHeaders(); 80b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 81b6c97c70SAndreas Gohr $this->assertEquals('andi@splitbrain.org', $headers['To']); 82b6c97c70SAndreas Gohr 83b6c97c70SAndreas Gohr $mail->to('<andi@splitbrain.org>'); 84b6c97c70SAndreas Gohr $mail->cleanHeaders(); 85b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 86b6c97c70SAndreas Gohr $this->assertEquals('andi@splitbrain.org', $headers['To']); 87b6c97c70SAndreas Gohr 88b6c97c70SAndreas Gohr $mail->to('Andreas Gohr <andi@splitbrain.org>'); 89b6c97c70SAndreas Gohr $mail->cleanHeaders(); 90b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 91b6c97c70SAndreas Gohr $this->assertEquals('Andreas Gohr <andi@splitbrain.org>', $headers['To']); 92b6c97c70SAndreas Gohr 93b6c97c70SAndreas Gohr $mail->to('Andreas Gohr <andi@splitbrain.org> , foo <foo@example.com>'); 94b6c97c70SAndreas Gohr $mail->cleanHeaders(); 95b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 96b6c97c70SAndreas Gohr $this->assertEquals('Andreas Gohr <andi@splitbrain.org>, foo <foo@example.com>', $headers['To']); 97b6c97c70SAndreas Gohr 98b6c97c70SAndreas Gohr $mail->to('Möp <moep@example.com> , foo <foo@example.com>'); 99b6c97c70SAndreas Gohr $mail->cleanHeaders(); 100b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 101b6c97c70SAndreas Gohr $this->assertEquals('=?UTF-8?B?TcO2cA==?= <moep@example.com>, foo <foo@example.com>', $headers['To']); 102b6c97c70SAndreas Gohr 103b6c97c70SAndreas Gohr $mail->to(array('Möp <moep@example.com> ',' foo <foo@example.com>')); 104b6c97c70SAndreas Gohr $mail->cleanHeaders(); 105b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 106b6c97c70SAndreas Gohr $this->assertEquals('=?UTF-8?B?TcO2cA==?= <moep@example.com>, foo <foo@example.com>', $headers['To']); 107b6c97c70SAndreas Gohr 108b6c97c70SAndreas Gohr $mail->to(array('Beet, L van <lvb@example.com>',' foo <foo@example.com>')); 109b6c97c70SAndreas Gohr $mail->cleanHeaders(); 110b6c97c70SAndreas Gohr $headers = $mail->prop('headers'); 111b6c97c70SAndreas Gohr $this->assertEquals('=?UTF-8?B?QmVldCwgTCB2YW4=?= <lvb@example.com>, foo <foo@example.com>', $headers['To']); 112b6c97c70SAndreas Gohr 113b6c97c70SAndreas Gohr 114b6c97c70SAndreas Gohr } 115b6c97c70SAndreas Gohr 116cc92aca7SAndreas Gohr function test_simplemail(){ 117cc92aca7SAndreas Gohr global $conf; 118cc92aca7SAndreas Gohr $conf['htmlmail'] = 0; 1199ea45836SChristopher Smith 1209ea45836SChristopher Smith $mailbody = 'A test mail in ASCII'; 121cc92aca7SAndreas Gohr $mail = new TestMailer(); 122cc92aca7SAndreas Gohr $mail->to('test@example.com'); 1239ea45836SChristopher Smith $mail->setBody($mailbody); 124cc92aca7SAndreas Gohr 125cc92aca7SAndreas Gohr $dump = $mail->dump(); 1269ea45836SChristopher Smith 1279ea45836SChristopher Smith // construct the expected mail body text - include the expected dokuwiki signature 1289ea45836SChristopher Smith $replacements = $mail->prop('replacements'); 1299ea45836SChristopher Smith $expected_mail_body = chunk_split(base64_encode($mailbody.$replacements['text']['EMAILSIGNATURE']),72,MAILHEADER_EOL); 1309ea45836SChristopher Smith 131cc92aca7SAndreas Gohr $this->assertNotRegexp('/Content-Type: multipart/',$dump); 132cc92aca7SAndreas Gohr $this->assertRegexp('#Content-Type: text/plain; charset=UTF-8#',$dump); 1339ea45836SChristopher Smith $this->assertRegexp('/'.preg_quote($expected_mail_body,'/').'/',$dump); 134cc92aca7SAndreas Gohr 135cc92aca7SAndreas Gohr $conf['htmlmail'] = 1; 136cc92aca7SAndreas Gohr } 137cc92aca7SAndreas Gohr 138cc92aca7SAndreas Gohr function test_replacements(){ 139cc92aca7SAndreas Gohr $mail = new TestMailer(); 140cc92aca7SAndreas Gohr 1419e01e280SChristopher Smith $replacements = array( '@DATE@','@BROWSER@','@IPADDRESS@','@HOSTNAME@','@EMAILSIGNATURE@', 142cc92aca7SAndreas Gohr '@TITLE@','@DOKUWIKIURL@','@USER@','@NAME@','@MAIL@'); 143cc92aca7SAndreas Gohr $mail->setBody('A test mail in with replacements '.join(' ',$replacements)); 144cc92aca7SAndreas Gohr 145cc92aca7SAndreas Gohr $text = $mail->prop('text'); 146cc92aca7SAndreas Gohr $html = $mail->prop('html'); 147cc92aca7SAndreas Gohr 148cc92aca7SAndreas Gohr foreach($replacements as $repl){ 149cc92aca7SAndreas Gohr $this->assertNotRegexp("/$repl/",$text,"$repl replacement still in text"); 150cc92aca7SAndreas Gohr $this->assertNotRegexp("/$repl/",$html,"$repl replacement still in html"); 151cc92aca7SAndreas Gohr } 152cc92aca7SAndreas Gohr } 153cc92aca7SAndreas Gohr 15491effd8dSDominik Eckelmann /** 15591effd8dSDominik Eckelmann * @see https://forum.dokuwiki.org/post/35822 15691effd8dSDominik Eckelmann */ 1571f61f312SDominik Eckelmann function test_emptyBCCorCC() { 1581f61f312SDominik Eckelmann $mail = new TestMailer(); 1591f61f312SDominik Eckelmann $headers = &$mail->propRef('headers'); 1601f61f312SDominik Eckelmann $headers['Bcc'] = ''; 1611f61f312SDominik Eckelmann $headers['Cc'] = ''; 1621f61f312SDominik Eckelmann $header = $mail->prepareHeaders(); 1631f61f312SDominik Eckelmann $this->assertEquals(0, preg_match('/(^|\n)Bcc: (\n|$)/', $header), 'Bcc found in headers.'); 1646be717dbSMichael Hamann $this->assertEquals(0, preg_match('/(^|\n)Cc: (\n|$)/', $header), 'Cc found in headers.'); 1656be717dbSMichael Hamann } 1666be717dbSMichael Hamann 1676be717dbSMichael Hamann function test_nullTOorCCorBCC() { 1686be717dbSMichael Hamann $mail = new TestMailer(); 1696be717dbSMichael Hamann $headers = &$mail->propRef('headers'); 1706be717dbSMichael Hamann $headers['Bcc'] = NULL; 1716be717dbSMichael Hamann $headers['Cc'] = NULL; 1726be717dbSMichael Hamann $headers['To'] = NULL; 1736be717dbSMichael Hamann $header = $mail->prepareHeaders(); 1746be717dbSMichael Hamann $this->assertEquals(0, preg_match('/(^|\n)Bcc: (\n|$)/', $header), 'Bcc found in headers.'); 1756be717dbSMichael Hamann $this->assertEquals(0, preg_match('/(^|\n)Cc: (\n|$)/', $header), 'Cc found in headers.'); 1766be717dbSMichael Hamann $this->assertEquals(0, preg_match('/(^|\n)To: (\n|$)/', $header), 'To found in headers.'); 1771f61f312SDominik Eckelmann } 1780ee5ed1eSAndreas Gohr 1790ee5ed1eSAndreas Gohr /** 1800ee5ed1eSAndreas Gohr * @group internet 1810ee5ed1eSAndreas Gohr */ 1820ee5ed1eSAndreas Gohr function test_lint(){ 1830ee5ed1eSAndreas Gohr // prepare a simple multipart message 1840ee5ed1eSAndreas Gohr $mail = new TestMailer(); 1850ee5ed1eSAndreas Gohr $mail->to(array('Möp <moep@example.com> ',' foo <foo@example.com>')); 186d6e04b60SAndreas Gohr $mail->from('Me <test@example.com>'); 1870ee5ed1eSAndreas Gohr $mail->subject('This is a töst'); 1880ee5ed1eSAndreas Gohr $mail->setBody('Hello Wörld, 1890ee5ed1eSAndreas Gohr 1900ee5ed1eSAndreas Gohr please don\'t burn, okay? 1910ee5ed1eSAndreas Gohr '); 192ec82d005SAndreas Gohr $mail->attachContent('some test data', 'text/plain', 'a text.txt'); 1930ee5ed1eSAndreas Gohr $msg = $mail->dump(); 1940ee5ed1eSAndreas Gohr $msglines = explode("\n", $msg); 1950ee5ed1eSAndreas Gohr 196d6e04b60SAndreas Gohr //echo $msg; 197d6e04b60SAndreas Gohr 1980ee5ed1eSAndreas Gohr // ask message lint if it is okay 1990ee5ed1eSAndreas Gohr $html = new HTTPClient(); 2007468fb90SAndreas Gohr $results = $html->post('https://tools.ietf.org/tools/msglint/msglint', array('msg'=>$msg)); 20195e6ded1SAndreas Gohr if($results === false) { 20295e6ded1SAndreas Gohr $this->markTestSkipped('no response from validator'); 20395e6ded1SAndreas Gohr return; 20495e6ded1SAndreas Gohr } 2050ee5ed1eSAndreas Gohr 2060ee5ed1eSAndreas Gohr // parse the result lines 2070ee5ed1eSAndreas Gohr $lines = explode("\n", $results); 2080ee5ed1eSAndreas Gohr $rows = count($lines); 2090ee5ed1eSAndreas Gohr $i=0; 2100ee5ed1eSAndreas Gohr while(trim($lines[$i]) != '-----------' && $i<$rows) $i++; //skip preamble 2110ee5ed1eSAndreas Gohr for($i=$i+1; $i<$rows; $i++){ 2120ee5ed1eSAndreas Gohr $line = trim($lines[$i]); 2130ee5ed1eSAndreas Gohr if($line == '-----------') break; //skip appendix 2140ee5ed1eSAndreas Gohr 2150ee5ed1eSAndreas Gohr // get possible continuation of the line 2160ee5ed1eSAndreas Gohr while($lines[$i+1][0] == ' '){ 2170ee5ed1eSAndreas Gohr $line .= ' '.trim($lines[$i+1]); 2180ee5ed1eSAndreas Gohr $i++; 2190ee5ed1eSAndreas Gohr } 2200ee5ed1eSAndreas Gohr 2210ee5ed1eSAndreas Gohr // check the line for errors 222ec82d005SAndreas Gohr if(substr($line,0,5) == 'ERROR' || substr($line,0,7) == 'WARNING'){ 223d6e04b60SAndreas Gohr // ignore some errors 224d6e04b60SAndreas Gohr if(strpos($line, "missing mandatory header 'return-path'")) continue; #set by MDA 225acb389a8SAndreas Gohr if(strpos($line, "bare newline in text body decoded")) continue; #we don't send mail bodies as CRLF, yet 226acb389a8SAndreas Gohr if(strpos($line, "last decoded line too long")) continue; #we don't send mail bodies as CRLF, yet 227d6e04b60SAndreas Gohr 2280ee5ed1eSAndreas Gohr // get the context in which the error occured 2290ee5ed1eSAndreas Gohr $errorin = ''; 2300ee5ed1eSAndreas Gohr if(preg_match('/line (\d+)$/', $line, $m)){ 2310ee5ed1eSAndreas Gohr $errorin .= "\n".$msglines[$m[1] - 1]; 2320ee5ed1eSAndreas Gohr } 2330ee5ed1eSAndreas Gohr if(preg_match('/lines (\d+)-(\d+)$/', $line, $m)){ 2340ee5ed1eSAndreas Gohr for($x=$m[1]-1; $x<$m[2]; $x++){ 2350ee5ed1eSAndreas Gohr $errorin .= "\n".$msglines[$x]; 2360ee5ed1eSAndreas Gohr } 2370ee5ed1eSAndreas Gohr } 2380ee5ed1eSAndreas Gohr 2390ee5ed1eSAndreas Gohr // raise the error 2400ee5ed1eSAndreas Gohr throw new Exception($line.$errorin); 2410ee5ed1eSAndreas Gohr } 2420ee5ed1eSAndreas Gohr } 2430ee5ed1eSAndreas Gohr 2440ee5ed1eSAndreas Gohr } 245*774514c9SGerrit Uitslag 246*774514c9SGerrit Uitslag function test_simplemailsignature(){ 247*774514c9SGerrit Uitslag global $conf; 248*774514c9SGerrit Uitslag $conf['htmlmail'] = 0; 249*774514c9SGerrit Uitslag 250*774514c9SGerrit Uitslag $mailbody = 'A test mail in ASCII'; 251*774514c9SGerrit Uitslag $signature = "\n-- \n" . 'This mail was generated by DokuWiki at' . "\n" . DOKU_URL . "\n"; 252*774514c9SGerrit Uitslag $mail = new TestMailer(); 253*774514c9SGerrit Uitslag $mail->to('test@example.com'); 254*774514c9SGerrit Uitslag $mail->setBody($mailbody); 255*774514c9SGerrit Uitslag 256*774514c9SGerrit Uitslag $dump = $mail->dump(); 257*774514c9SGerrit Uitslag 258*774514c9SGerrit Uitslag // construct the expected mail body text - include the expected dokuwiki signature 259*774514c9SGerrit Uitslag $expected_mail_body = chunk_split(base64_encode($mailbody.$signature),72,MAILHEADER_EOL); 260*774514c9SGerrit Uitslag $this->assertRegexp('/'.preg_quote($expected_mail_body,'/').'/',$dump); 261*774514c9SGerrit Uitslag 262*774514c9SGerrit Uitslag $conf['htmlmail'] = 1; 263*774514c9SGerrit Uitslag } 264*774514c9SGerrit Uitslag 265*774514c9SGerrit Uitslag function test_htmlmailsignature(){ 266*774514c9SGerrit Uitslag $mailbody_text = 'A test mail in ASCII :)'; 267*774514c9SGerrit Uitslag $mailbody_html = 'A test mail in <strong>html</strong>'; 268*774514c9SGerrit Uitslag $htmlmsg_expected = '<html> 269*774514c9SGerrit Uitslag<head> 270*774514c9SGerrit Uitslag <title>My Test Wiki</title> 271*774514c9SGerrit Uitslag <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 272*774514c9SGerrit Uitslag</head> 273*774514c9SGerrit Uitslag<body> 274*774514c9SGerrit Uitslag 275*774514c9SGerrit UitslagA test mail in <strong>html</strong> 276*774514c9SGerrit Uitslag 277*774514c9SGerrit Uitslag<br /><hr /> 278*774514c9SGerrit Uitslag<small>This mail was generated by DokuWiki at<br /><a href="http://wiki.example.com/tmp/">http://wiki.example.com/tmp/</a></small> 279*774514c9SGerrit Uitslag</body> 280*774514c9SGerrit Uitslag</html> 281*774514c9SGerrit Uitslag'; 282*774514c9SGerrit Uitslag 283*774514c9SGerrit Uitslag $mail = new TestMailer(); 284*774514c9SGerrit Uitslag $mail->to('test@example.com'); 285*774514c9SGerrit Uitslag $mail->setBody($mailbody_text,null,null,$mailbody_html); 286*774514c9SGerrit Uitslag 287*774514c9SGerrit Uitslag $dump = $mail->dump(); 288*774514c9SGerrit Uitslag 289*774514c9SGerrit Uitslag // construct the expected mail body text - include the expected dokuwiki signature 290*774514c9SGerrit Uitslag $expected_mail_body = chunk_split(base64_encode($htmlmsg_expected),72,MAILHEADER_EOL); 291*774514c9SGerrit Uitslag 292*774514c9SGerrit Uitslag $this->assertRegexp('/Content-Type: multipart/',$dump); 293*774514c9SGerrit Uitslag $this->assertRegexp('#Content-Type: text/plain; charset=UTF-8#',$dump); 294*774514c9SGerrit Uitslag $this->assertRegexp('/'.preg_quote($expected_mail_body,'/').'/',$dump); 295*774514c9SGerrit Uitslag 296*774514c9SGerrit Uitslag } 297*774514c9SGerrit Uitslag 298*774514c9SGerrit Uitslag function test_htmlmailsignaturecustom(){ 299*774514c9SGerrit Uitslag global $lang; 300*774514c9SGerrit 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>'; 301*774514c9SGerrit Uitslag 302*774514c9SGerrit Uitslag $mailbody_text = 'A test mail in ASCII :)'; 303*774514c9SGerrit Uitslag $mailbody_html = 'A test mail in <strong>html</strong>'; 304*774514c9SGerrit Uitslag $htmlmsg_expected = '<html> 305*774514c9SGerrit Uitslag<head> 306*774514c9SGerrit Uitslag <title>My Test Wiki</title> 307*774514c9SGerrit Uitslag <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 308*774514c9SGerrit Uitslag</head> 309*774514c9SGerrit Uitslag<body> 310*774514c9SGerrit Uitslag 311*774514c9SGerrit UitslagA test mail in <strong>html</strong> 312*774514c9SGerrit Uitslag 313*774514c9SGerrit Uitslag<br /><hr /> 314*774514c9SGerrit Uitslag<small>Official message from your DokuWiki <a href="http://wiki.example.com/tmp/">http://wiki.example.com/tmp/</a><br />Created by wonderful mail class <a href="https://www.dokuwiki.org/devel:mail">https://www.dokuwiki.org/devel:mail</a></small> 315*774514c9SGerrit Uitslag</body> 316*774514c9SGerrit Uitslag</html> 317*774514c9SGerrit Uitslag'; 318*774514c9SGerrit Uitslag 319*774514c9SGerrit Uitslag $mail = new TestMailer(); 320*774514c9SGerrit Uitslag $mail->to('test@example.com'); 321*774514c9SGerrit Uitslag $mail->setBody($mailbody_text,null,null,$mailbody_html); 322*774514c9SGerrit Uitslag 323*774514c9SGerrit Uitslag $dump = $mail->dump(); 324*774514c9SGerrit Uitslag 325*774514c9SGerrit Uitslag // construct the expected mail body text - include the expected dokuwiki signature 326*774514c9SGerrit Uitslag $replacements = $mail->prop('replacements'); 327*774514c9SGerrit Uitslag $expected_mail_body = chunk_split(base64_encode($htmlmsg_expected),72,MAILHEADER_EOL); 328*774514c9SGerrit Uitslag 329*774514c9SGerrit Uitslag $this->assertRegexp('/'.preg_quote($expected_mail_body,'/').'/',$dump); 330*774514c9SGerrit Uitslag 331*774514c9SGerrit Uitslag } 332cc92aca7SAndreas Gohr} 333cc92aca7SAndreas Gohr//Setup VIM: ex: et ts=4 : 334