Page 1 of 1

HTML in Custom Emails?

PostPosted: September 20th, 2011, 11:25 am
by bitofgrace
Hi again :)
Was attempting to customize the emails that s2 generates upon payment and registration to match our site's generated emails. (graphically)
The result coming through is raw HTML. : / What do i need to or can i do so that the emails maintain HTML table formatting?

-grace

Re: HTML in Custom Emails?

PostPosted: September 20th, 2011, 6:16 pm
by Cristián Lávaque
I believe the emails will be sent in plain text, I don't know if HTML emails are supported. I'll ask Jason.

Re: HTML in Custom Emails?

PostPosted: September 20th, 2011, 6:28 pm
by Jason Caldwell
Yes, all emails processed by s2Member are sent with a text/plain Content-Type header. You can Filter this with WordPress, but I don't advise doing so, because it may create problems ( i.e. this affects all instances of the wp_mail function ), not good.

Create this directory and file:
/wp-content/mu-plugins/wp-mail.php
Code: Select all
<?php
add_filter
("wp_mail_content_type", "wp_mail_content_type_force");
    function wp_mail_content_type_force(){ return "text/html"; }
?>

@TODO: I'll see what we can do in a future release to make HTML emails possible w/s2Member only.

Re: HTML in Custom Emails?

PostPosted: September 20th, 2011, 6:33 pm
by bitofgrace
Thank you for the help - for now will style the text somewhat like Paypal's receipt emails then :)

-grace

Re: HTML in Custom Emails?

PostPosted: September 21st, 2011, 7:45 am
by ffemtkl
Just an FYI... HTML (custom text?) emails will be supported in WP 3.3 (at least that is the plan).

see: http://core.trac.wordpress.org/ticket/18493

Re: HTML in Custom Emails?

PostPosted: September 27th, 2011, 12:52 pm
by Jason Caldwell
Good to know. Thanks for sharing this!