SHARE
TWEET

Untitled

a guest Jul 18th, 2019 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if ($is_html)
  2.     add_action('phpmailer_init', 'fix_mimeheader');
  3.  
  4. // more code.
  5.  
  6. wp_mail( $to, $subject, $html_message, $headers, $attachments );
  7.  
  8. // ...
  9.  
  10. function fix_mimeheader( $phpmailer ) {
  11.      // Generate $text_message here.
  12.      // ...
  13.  
  14.      $phpmailer->AltBody = $text_message;
  15. }
  16.      
  17. add_filter( 'wp_mail_content_type', 'my_mail_content_type' );
  18. function my_mail_content_type( $content_type ) {
  19.  
  20.     if( $some_condition ) {
  21.         return 'multipart/mixed';
  22.     } else {
  23.         return 'text/plain';
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top