WP-Members relies on WP’s wp_mail() function to send email. It’s important to understand a few things about wp_mail():
- By default, all emails are plain text.
- You can send HTML formatted email by changing the content type.
- The default “from” address is WP’s default – wordpress@yourdomain.com.
- The absolute best thing you can do for yourself to solve all email problems is to use SMTP to send your email!
Sending HTML Email
If you want to send HTML formatted email, you need to change the content type.
The plugin includes a setting in the Emails tab to automatically send emails as HTML format. (NOTE: When sending HTML formatted email, URLs are not “automatically” made clickable. You need to apply proper HTML markup for links and any other formatted text.)
Change ALL WP emails to HTML format
Use the wp_mail_content_type filter to set the content type to “text/html”:
add_filter( 'wp_mail_content_type', 'my_set_mail_content_type' ); function my_set_mail_content_type( $content_type ) { return 'text/html'; }
Change only WP-Members generated emails to HTML format
The wpmem_email_headers filter allows you to filter the email headers. Use that to set the email type as “text/html”:
add_filter( 'wpmem_email_headers', 'my_wpmem_html_email' ); function my_wpmem_html_email() { return "Content-Type: text/html" . "\r\n"; }
Adding one of above filter function to your functions.php file or a custom plugin file will allow you to send HTML formatted emails. Now you can use HTML in the email content in the plugin’s email management tab (be sure to include appropriate shortcodes for data being sent). There is more information on how to use code snippets from this site here.