Big problems with CRLF in E-Mails
| From: | SK-Sly | Date: | Sat, 30 Sep 2000 10:57:01 +0000 |
| Subject: | Big problems with CRLF in E-Mails | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18157@lists.php.net to get a copy of this message | ||
I send E-Mails with mail()
because the message must be "multipart" i bulid the header myself.
the CRLF is realisized as follows:
$cr = "\r";
$lf = "\n";
$crlf = $cr.$lf;
The header:
$header='From:';
$header=a_merge($header, $from, ' ');
$header=a_merge($header, 'Reply-To:', $crlf);
$header=a_merge($header, $from, ' ');
$header=a_merge($header, 'MIME-Version: 1.0', $crlf);
$header=a_merge($header, 'Content-Type: multipart/alternative; boundary=--SK--JE--',
$crlf);
a_merge puts tho string together with an seperator (the 3rd parameter) a_merge(string1, string2,
stringseparator)
The Body:
$message='----SK--JE--';
$message=a_merge($message, $crlf, '');
$message=a_merge($message, 'Content-Type: text/plain; charset="iso-8859-1"',
$crlf);
$message=a_merge($message, $crlf, '');
$message=a_merge($message, $ascmsg, $crlf);
$message=a_merge($message, '----SK--JE--', $crlf);
$message=a_merge($message, 'Content-Type: text/html; charset="iso-8859-1"',
$crlf);
$message=a_merge($message, $crlf, '');
$message=a_merge($message, $htmlmsg, $crlf);
$message=a_merge($message, '----SK--JE--', $crlf);
$ascmsg contains a string, which parts are separeted by $crlf
$htmlmsg contains a string (<html><body>.....</body></html>)
when I save $header and $message to files as follows:
$fp=fopen("header.txt", "w");
fputs($fp, $header);
fclose($fp);
$fp=fopen("message.txt", "w");
fputs($fp, $message);
fclose($fp);
the header.txt is OK (the CRLF works)
the message.txt is OK (the CRLF works)
i send the mail with:
mail($to, $subject, $message, $header); //$to and $subject is set ;-)
When I fetch the mail with Netscape Messenger allthing is OK, the Source of ther Mail is OK, all
CRLFs are OK. Te same thing mit PM-Mail 2000.
When I feth the mail with Outlook Express. There's no one CRFL set. -->(the whole body
appears in the body)
Where's the problem ???
Why my CRLF doesnt't work ???
all comments are very welcome!
tnx