I have an interface to send e-mails through
SMTP (I use the plug-in
I collect messages in the DB that I sent to someone depending on the results of an SQL request.
In the DB, I stored the messages using the char
for line breaks.
Here is the code (I replace e-mail addresses with xxx, but obviously I use my client's e-mail address in the real piece) :
$subject = $res->subject; $message = utf8_encode( $msg ); $to = $res->url ; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= 'From: XXX <firstname.lastname@example.org>' . "\r\n" . 'Reply-To: email@example.com' . "\r\n"; $sent = wp_mail($to, $subject , $message , $headers);
Everything works (I receive the right e-mail with proper encoding), however everything is sent on a single line (when there should be a line break each time there is a
in the database message).
Oddly, there are no
in the e-mail, they are just deleted from the message.
I also tried to add the following lines (on separate tests, obviously) :
$message = str_replace(' ', "\r\n", $message); $message = str_replace(' ', '<br />', $message);
But I get the same results.
Could you please help me sort this out ?