I'm modifying a plugin (post2mail) to modernize it, thinking that that would resolve the issue I'm having -- namely, that while the plugin does indeed email something, it isn't quite correct, in that p tags in post_content are gone. a tags are there, and ul and li tags, but not p. This is infuriating, as my output looks terrible. The p tags are simply gone. Is this by design? Is there some way I could make this not so? It's so close to working the way I want it to. the code:
function post2mail($post_ID){
global $linktext;
require_once('post2mail.config.php');
$the_post = get_post($post_ID, ARRAY_A);
$subject = stripslashes($the_post['post_title']);
/* message */
if ($sendHTML) {
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$message = convert_chars($the_post['post_content']);
$message .= addMailLinkBack($post_ID);
}
else {
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$message = stripslashes(strip_tags($the_post['Content']));
$message .= "\r\n\r\n" . $linktext . ': ' . get_permalink($post_ID);
$subject = "=?UTF-8?B?".base64_encode($subject)."?=";
}
/* additional headers */
$headers .= "From: $from\r\n";
if ($cc != '') {
$headers .= "Cc: $cc\r\n";
}
if ($bcc != '') {
$headers .= "Bcc: $bcc\r\n";
}
/* and now mail it */
mail($to, $subject, $message, $headers);
return $post_ID;
}
add_action('publish_post', 'post2mail', 5);
Any help will be enormously appreciated.