I saw already this answer. And it helped me to make unique mail. It's great. But how to format some text using HTML? For example to work with tags

 <b> <i> <font color="red"> <img src="">

I wrote

spintf("<a href="http://site.com/some-page">Text</a>");

And on my mail I got letter with <a href="http://site.com/some-page">Text</a> instead of this Text. It seems that WordPress mailer cut HTML, cause I tried printf and echo. Or may be I just do something wrong?

1 Answer 1


wp_mail from Codex

Use this example:

add_filter( 'wp_mail_content_type', 'set_html_content_type' );

wp_mail( $mails_to, 'The subject', '<p>The <em>HTML</em> message</p>' );

// Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
remove_filter( 'wp_mail_content_type', 'set_html_content_type' );

function set_html_content_type() {

    return 'text/html';

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.