Guest User

Untitled

a guest
Mar 18th, 2018
1,564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. $email_to = '[email protected]';
  2. $email_subject = 'Email subject';
  3. $email_body = "<html><body><h1>Hello World!</h1></body></html>";
  4. $send_mail = wp_mail($email_to, $email_subject, $email_body);
  5.  
  6. // In theme's functions.php or plug-in code:
  7.  
  8. function wpse27856_set_content_type(){
  9. return "text/html";
  10. }
  11. add_filter( 'wp_mail_content_type','wpse27856_set_content_type' );
  12.  
  13. $subject = 'The subject';
  14. $body = 'The email body content';
  15. $headers = array('Content-Type: text/html; charset=UTF-8');
  16.  
  17. wp_mail( $to, $subject, $body, $headers );
  18.  
  19. remove_filter( 'wp_mail_content_type','wpse27856_set_content_type' );
  20.  
  21. if ( !isset( $content_type ) )
  22. $content_type = 'text/html';
Add Comment
Please, Sign In to add comment