wordpress snippets last updated   : August 18, 2014
we now have 638 snippets

Set the content type email from text/plain to text/html

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will let you set the content type of email from text/plain to text/html.

snippet :  PHPcopy
function wps_set_content_type(){
    return "text/html";
}
add_filter( 'wp_mail_content_type','wps_set_content_type' );

Did you like this post? If so please share it with your friends. Thanks!

  • http://www.facebook.com/serradinho George Serradinho

    I used this code, but then when a user requests to reset his password, then the link in the email that gets sent to the user has no link to click on. do you know what the issue could be?

    • Matt

      If you are working off your localhost it may have issues using the mail function, try going via ftp.

  • http://www.txtimpact.com/text-messaging-service.asp TextMessage

    Allow customers to request real-time information
    about your business via text message, while putting your contact information in
    the customer’s phone for future reference as well as allow you to capture
    customer’s mobile number

  • http://lab41.co/ Alex

    Is there a way to do this the other way around? Set content type from HTML to plain?

jqsnipp.com | we just launched jquery snippets website