Instead of:


Thank you dfasdfasdfasdf asdf asdf asdfas dfs

Please, feelasdf asdf asdf 

The email that arrives in my mailbox looks like the following:

<p>Thank you dfasdfasdfasdf asdf asdf asdfas dfs</p> 
<p>Please, feel asdfads fad f</p> 

So, I guess the HTML is not turned on for the wp_mail() function? How do you turn it on so the mail will arrive as it should and the <p> and <br> tags are interpreted correctly?

I am using this to send my mail from functions.php when the submit button is pressed:

   $headers = 'From: XXXXXX.com <[email protected]>' . "\r\n";
   $subject = 'Registration from xxxxx.com' . "\r\n"; 
   $message = $result_email_text;
   wp_mail($_POST['admin_email'], $subject, $message, $headers );

1 Answer 1


The default content type is 'text/plain' which does not allow using HTML. You can set the content type of the email by including a header like "Content-type: text/html"

$headers = 'Content-type: text/html;charset=utf-8' . "\r\n";
$headers .= 'From: XXXXXX.com <[email protected]>' . "\r\n";
   $subject = 'Registration from xxxxx.com' . "\r\n"; 
   $message = $result_email_text;
   wp_mail($_POST['admin_email'], $subject, $message, $headers );

Or you can set it by using the wp_mail_content_type filter

remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
add_filter( 'wp_mail_content_type', 'set_html_content_type' );
function set_html_content_type() {

    return 'text/html';

For more detail see the following link: http://codex.wordpress.org/Function_Reference/wp_mail

  • THanks, it's working nice if you are using English. Please, change the charset in your answer to something that is more universal, because unless it's English you would heve problems using iso-8859-1 and it's not recommended anymore to use iso-8859-1. Thanks.
    – Derfder
    Oct 10, 2013 at 13:26
  • @Derfder Please accept the answer.so this answer will notify as right and it's useful for the other users.
    – dipali
    Oct 10, 2013 at 13:47
  • Please, add to your answer something like charset=utf-8 so it is universal, thanks.
    – Derfder
    Oct 10, 2013 at 15:27
  • Hi @dipali thanks for your good answer. It worked for me! :-) Oct 2, 2014 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.