Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Mail will not send in HTML

Try this one.

  add_filter( 'wp_mail_content_type', 'wpdocs_set_html_mail_content_type' );

    $to = '[email protected]';
    $subject="The subject";
    $body = 'The email body content';
    $headers = array('Content-Type: text/html; charset=UTF-8');

    wp_mail( $to, $subject, $body , $headers);

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

    function wpdocs_set_html_mail_content_type() {
        return 'text/html';
    }

Related Posts:

  1. HTML email sent with wp_mail shows plain text
  2. Can I set subject/content of email using mailto:?
  3. Include HTML template file in wp_mail
  4. WP mail sent to MS Exchange recipients = occasional email corruption?
  5. Images in wp_mail not showing
  6. Programming WordPress to send a custom-built form to specified email address
  7. Use Mail-Tag from Contac Form 7 in a script
  8. get_post_meta is always empty when I use wp_mail
  9. Send and receive emails with wp_mail() for WP User (like Mailserver)
  10. Is HTML considered a programming language? [closed]
  11. Open source social media icons to download and use on website? [closed]
  12. How to make a monopoly board using css grid?
  13. How to add a browser tab icon (favicon) for a website?
  14. Redirect from an HTML page
  15. Redirect from an HTML page
  16. What is ' and why does Google search replace it with apostrophe?
  17. What’s the difference between ” ” and ” “?
  18. Should I use tag for icons instead of ? [closed]
  19. Open link in new tab or window [duplicate]
  20. Half circle with CSS (border, outline only)
  21. Line break in HTML with ‘\n’
  22. CSS calc width and height values
  23. HTML encoding issues – “” character showing up instead of ” “
  24. How to horizontally center an element
  25. Center image using text-align center?
  26. Unblur content inside blurring background div
  27. Adding a favicon to a static HTML page
  28. Failed to load resource: the server responded with a status of 404 (Not Found) css
  29. Edit webpage with javascript trick – how to “unedit”?
  30. See answer keys in Google Form (quiz) source page?
  31. CSS Background Opacity [duplicate]
  32. Angular, image not found (GET 404)
  33. what do
    and do?
  34. CSS Background Opacity [duplicate]
  35. reCAPTCHA ERROR: Invalid domain for site key
  36. Android WebView err_unknown_url_scheme
  37. Customize icon for “Add to home screen”
  38. How to create an HTML button that acts like a link
  39. What do < and > stand for?
  40. What’s the difference between HTML ‘hidden’ and ‘aria-hidden’ attributes?
  41. How to create an HTML button that acts like a link
  42. count(): Parameter must be an array or an object that implements Countable error in php
  43. Can I force a page break in HTML printing?
  44. count(): Parameter must be an array or an object that implements Countable error in php
  45. How do I vertically align text in a div?
  46. What is the difference between HTML tags
    and ?
  47. Hide scroll bar, but while still being able to scroll
  48. CSS background-image-opacity?
  49. How to create an HTML button that acts like a link
  50. Resize image proportionally with CSS?
  51. What character encoding is >?
  52. HTML 5: Is it
    ,
    , or
    ?
  53. What is the main difference of
    and
  54. Setting table column width
  55. How do I vertically align text in a div?
  56. What does In html mean
  57. How to set a border for an HTML div tag
  58. How can I center text (horizontally and vertically) inside a div block?
  59. iframe refuses to display
  60. Embed image in a
  61. Setting table column width
  62. Why does z-index not work?
  63. How do I vertically center text with CSS?
  64. Automatically pausing html5 video as the ‘next’ button is pressed (javascript/ jquery)
  65. What is difference between png8 and png24
  66. Center image horizontally within a div
  67. Draw Circle using css alone [duplicate]
  68. How to get a tab character?
  69. Failed to load resource: the server responded with a status of 404 (Not Found) css
  70. Why does z-index not work?
  71. How do I vertically center text with CSS?
  72. What does do?
  73. Is it possible to write data to file using only JavaScript?
  74. What is the difference between
    and
    ?
  75. What does enctype=’multipart/form-data’ mean?
  76. How to center an iframe horizontally?
  77. Can I have an onclick effect in CSS?
  78. Which characters need to be escaped in HTML?
  79. Image is not showing in browser?
  80. Link with target=”_blank” and rel=”noopener noreferrer” still vulnerable?
  81. Adding a background image to a
    element
  82. How to style a checkbox using CSS
  83. Remove CSS class from element with JavaScript (no jQuery) [duplicate]
  84. Add hover text without javascript like we hover on a user’s reputation
  85. Transparent CSS background color
  86. What does do?
  87. How to get a tab character?
  88. Is it possible to write data to file using only JavaScript?
  89. Creating a nav bar with flexbox
  90. How to make JavaScript execute after page load?
  91. Set cookie and get cookie with JavaScript
  92. How can I set the default value for an HTML

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress