[Plugin: Subscribe2] emails have no line breaks. how to add them
-
I was using Subscribe2. After an update, the E-mails started getting sent out with no line breaks. Meaning a well formatted blog post was being jumbled up into all 1 line with no spaces between paragraphs.
To fix this I edited the subscribe2.php code.
The origonal piece of code looked like this:
// remove excess white space from with $excerpt and $plaintext $excerpt = preg_replace('|\s+|', ' ', $excerpt); $plaintext = preg_replace('|\s+|', ' ', $plaintext); // prepare mail body texts $excerpt_body = str_replace("{POST}", $excerpt, $mailtext); $full_body = str_replace("{POST}", strip_tags($plaintext), $mailtext); $html_body = str_replace("\r\n", "<br />\r\n", $mailtext); $html_body = str_replace("{POST}", $content, $html_body); $html_excerpt_body = str_replace("\r\n", "<br />\r\n", $mailtext); $html_excerpt_body = str_replace("{POST}", $html_excerpt, $html_excerpt_body);
I changed it to this:
// remove excess white space from with $excerpt and $plaintext // $excerpt = preg_replace('|\s+|', ' ', $excerpt); // $plaintext = preg_replace('|\s+|', ' ', $plaintext); // prepare mail body texts $excerpt_body = str_replace("{POST}", $excerpt, $mailtext); $full_body = str_replace("{POST}", strip_tags($plaintext), $mailtext); $html_body = nl2br($mailtext); $html_body = str_replace("{POST}", $content, $html_body); $html_excerpt_body = nl2br($mailtext); $html_excerpt_body = str_replace("{POST}", $html_excerpt, $html_excerpt_body);
Hope that helps anyone who has the same problem. I spent hours looking for people talking about this, and ended up just editing the code myself.
- The topic ‘[Plugin: Subscribe2] emails have no line breaks. how to add them’ is closed to new replies.