use CRLF for mail body as discussed in #1101
This has to be tested with real world mailers
This commit is contained in:
parent
acb389a81a
commit
e05f34f838
|
@ -126,7 +126,9 @@ class mailer_test extends DokuWikiTest {
|
|||
|
||||
// construct the expected mail body text - include the expected dokuwiki signature
|
||||
$replacements = $mail->prop('replacements');
|
||||
$expected_mail_body = chunk_split(base64_encode($mailbody.$replacements['text']['EMAILSIGNATURE']),72,MAILHEADER_EOL);
|
||||
$expected_mail_body = chunk_split(base64_encode(
|
||||
str_replace("\n", "\r\n", $mailbody.$replacements['text']['EMAILSIGNATURE'])
|
||||
),72,MAILHEADER_EOL);
|
||||
|
||||
$this->assertNotRegexp('/Content-Type: multipart/',$dump);
|
||||
$this->assertRegexp('#Content-Type: text/plain; charset=UTF-8#',$dump);
|
||||
|
@ -222,8 +224,6 @@ class mailer_test extends DokuWikiTest {
|
|||
if(substr($line,0,5) == 'ERROR' || substr($line,0,7) == 'WARNING'){
|
||||
// ignore some errors
|
||||
if(strpos($line, "missing mandatory header 'return-path'")) continue; #set by MDA
|
||||
if(strpos($line, "bare newline in text body decoded")) continue; #we don't send mail bodies as CRLF, yet
|
||||
if(strpos($line, "last decoded line too long")) continue; #we don't send mail bodies as CRLF, yet
|
||||
|
||||
// get the context in which the error occured
|
||||
$errorin = '';
|
||||
|
|
|
@ -461,6 +461,14 @@ class Mailer {
|
|||
return false;
|
||||
}
|
||||
|
||||
// ensure content is CRLF encoded
|
||||
$this->text = str_replace("\r\n", "\n", $this->text);
|
||||
$this->text = str_replace("\r", "\n", $this->text);
|
||||
$this->text = str_replace("\n", "\r\n", $this->text);
|
||||
$this->html = str_replace("\r\n", "\n", $this->html);
|
||||
$this->html = str_replace("\r", "\n", $this->html);
|
||||
$this->html = str_replace("\n", "\r\n", $this->html);
|
||||
|
||||
// add general headers
|
||||
$this->headers['MIME-Version'] = '1.0';
|
||||
|
||||
|
|
Loading…
Reference in New Issue