Content-Type: text/html to enable links in email alert
-
I wanted to receive an HTML email alert rather than plaintext, so that I could use the variables to produce links to provide a more useful email message.
I made the following two changes to user-submitted-posts.php:
Add line (after setting $message variable):
$message = str_replace(“\r\n”, “<br>”, $message);
Change line:
$headers .= ‘Content-Type: text/plain; charset=’. get_option(‘blog_charset’, ‘UTF-8’) . “\n”;
to:
$headers .= ‘Content-Type: text/html; charset=’. get_option(‘blog_charset’, ‘UTF-8’) . “\n”;
–
It would be convenient to provide this as a configurable setting, or even better, to auto detect whether the message contains html and if so, to automatically set the appropriate header.
- The topic ‘Content-Type: text/html to enable links in email alert’ is closed to new replies.