Title: HTML emails
Last modified: January 3, 2019

---

# HTML emails

 *  Resolved [lbbjon](https://wordpress.org/support/users/lbbjon/)
 * (@lbbjon)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/html-emails-9/)
 * Hello,
 * Does wp-members support html and css within the ‘Email’ notification sectio?.
   I tried adding a template just to test, but only displayed code.
 * Is only RichText allowed?
 * Many thanks,
    Jon.
    -  This topic was modified 7 years, 5 months ago by [lbbjon](https://wordpress.org/support/users/lbbjon/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Chad Butler](https://wordpress.org/support/users/cbutlerjr/)
 * (@cbutlerjr)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/html-emails-9/#post-11049571)
 * The plugin sends whatever WP is set to send. That’s plain text by default (WP
   does not assume an HTML default email). You can change that a number of ways:
    - Change all `wp_mail()` messages to HTML format with [`wp_mail_content_type`](https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_mail_content_type).
    - Change all `wp_mail()` messages to HTML format by filtering the content type
      in the header using the [`wp_mail`](https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_mail)
      filter.
    - Change only WP-Members’ messages going through `wp_mail()` by using the [`wpmem_email_headers` filter](https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_email_headers/)
      to change the content type in the `wp_mail()` header (only fires when the 
      message is generated by WP-Members).
 * Some practical examples:
    [https://rocketgeek.com/filter-hooks/sending-html-emails-from-the-wp-members-plugin/](https://rocketgeek.com/filter-hooks/sending-html-emails-from-the-wp-members-plugin/)
    -  This reply was modified 7 years, 5 months ago by [Chad Butler](https://wordpress.org/support/users/cbutlerjr/).
 *  Thread Starter [lbbjon](https://wordpress.org/support/users/lbbjon/)
 * (@lbbjon)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/html-emails-9/#post-11051573)
 * Thanks for getting back to me Chad.
 * I am not really familiar with php, but if I created a custom plugin and activate
   it, would this override the core code or replace it? – If I were to use the php
   filter that specifically targets the wp-members plugin:
 *     ```
       add_filter( 'wpmem_email_headers', 'my_wpmem_html_email' );
       function my_wpmem_html_email() {
           return "Content-Type: text/html";
       }
       ```
   
 * Many thanks,
    Jon.
 *  Thread Starter [lbbjon](https://wordpress.org/support/users/lbbjon/)
 * (@lbbjon)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/html-emails-9/#post-11051732)
 * Also, are there any risks associated with adding this php filter via a custom
   plugin? I.e. would it affect other emailing/notification plugins or operations
   I have set up.
 *  Plugin Author [Chad Butler](https://wordpress.org/support/users/cbutlerjr/)
 * (@cbutlerjr)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/html-emails-9/#post-11055064)
 * > I am not really familiar with php, but if I created a custom plugin and activate
   > it, would this override the core code or replace it?
 * WP is loaded with “hooks” which can be either “filters” or “actions”. This is
   what allows WordPress to be customized, and it is the premise upon which all 
   plugins are built.
 * A filter hook allows you to change a value. There’s a value that WP generates,
   and then the hook is there to allow you an opportunity to change that before 
   it gets used.
 * In this particular case, the ‘wpmem_email_headers’ filter hook allows you to 
   change the email headers that are passed to wp_mail() when WP-Members generates
   an email. In the example code, it’s just changing the content type so that it
   is an html email.
 * > Also, are there any risks associated with adding this php filter via a custom
   > plugin? I.e. would it affect other emailing/notification plugins or operations
   > I have set up.
 * As I mentioned in the original answer – ‘wpmem_email_headers’ only affects emails
   generated by WP-Members.
 *  Thread Starter [lbbjon](https://wordpress.org/support/users/lbbjon/)
 * (@lbbjon)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/html-emails-9/#post-11065019)
 * Thanks for the explanation.
 * I have added a custom plugin which included the php filter specific to wp-members,
   following the guide on your site.
 * I am glad to say this has worked and now all emails send in HTML, as well as 
   appear correctly.
 * Thanks for the hand!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘HTML emails’ is closed to new replies.

 * ![](https://ps.w.org/wp-members/assets/icon-256x256.png?rev=1226414)
 * [WP-Members Membership Plugin](https://wordpress.org/plugins/wp-members/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-members/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-members/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-members/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-members/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-members/reviews/)

## Tags

 * [email notification](https://wordpress.org/support/topic-tag/email-notification/)

 * 5 replies
 * 2 participants
 * Last reply from: [lbbjon](https://wordpress.org/support/users/lbbjon/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/html-emails-9/#post-11065019)
 * Status: resolved