Woocommerce HTML email option unavailable
I think you missing function argument. just try it. add_filter(‘wp_mail_content_type’,’set_content_type’); function set_content_type($content_type){ return ‘text/html’; }
I think you missing function argument. just try it. add_filter(‘wp_mail_content_type’,’set_content_type’); function set_content_type($content_type){ return ‘text/html’; }
I suspect you implemented the hook something like this: function wp_set_html_mail_content_type() { return ‘text/html’; } add_filter( ‘wp_mail_content_type’, ‘wp_set_html_mail_content_type’ ); More info: https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_mail_content_type Did you need to reset the content type at a later point? ** UPDATE: try intercept it with a global variable: function xxx_wp_email_content_type() { if($GLOBALS[“use_html_content_type”]){ return ‘text/html’; }else{ return ‘text/plain’; } } add_filter( … Read more
You are looking for a mailing plugin that can send mails in digests. One example is Subscribe2, which can be set from once hourly to weekly, but you can probably modify the code so it extends to quarterly mailings.
Check to see if you can hook into phpmailer_init and set AltBody. add_action(‘phpmailer_init’, ‘add_plain_text’); function add_plain_text($phpmailer) { $phpmailer->AltBody = “This is a text message”; } Bonus: pass your HTML through premailer.dialect.ca to render a usable text version and find more info on multipart email at Things I’ve Learned About Building & Coding HTML Email Templates. … Read more
Per my comment to your question, I believe the problem is that includeing files, whether directly or using get_template_part isn’t likely to give you a string to pass to $body and that is going to cause errors in the code, or at the very least unespected behavior. I would avoid reading files into memory and … Read more
I’m afraid you’ll have to use the pluggable functions feature – there’s no filter or hook inside those functions (as you can see from the code below). And what’s worse, for you, it’s better to use pluggable function in a plugin. This is because defining new pluggable function in your theme’s functions.php requests you to … Read more
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’; }
You should use ob_get_contents() ob_start(); include(‘template/email-header.php’); printf(__(‘<p>A very special welcome to you, %1$s. Thank you for joining %2$s!</p>’, ‘cell-email’), $greetings, get_bloginfo(‘name’)); printf(__(‘<p> Your password is <strong style=”color:orange”>%s</strong> <br> Please keep it secret and keep it safe! </p>’, ‘cell-email’), $plaintext_pass); printf(__(‘<p>We hope you enjoy your stay at %s. If you have any problems, questions, opinions, praise, … Read more
If I’m understanding you right you just are having trouble getting the from set? The easiest way would just be adding the from in the email headers in the wp_mail function. Here is an example of one of my old simple email sending functions that works: function contact_send() { $title=”New message Received”; $headers = array(‘From: … Read more
from wp_mail codex page: The default content type is ‘text/plain’ which does not allow using HTML. However, you can set the content type of the email by using the ‘wp_mail_content_type’ filter. // In theme’s functions.php or plug-in code: function wpse27856_set_content_type(){ return “text/html”; } add_filter( ‘wp_mail_content_type’,’wpse27856_set_content_type’ );