Guest User

Untitled

a guest
Mar 18th, 2018
1,559
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 = 'someaddress@gmail.com';
  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. $to = 'sendto@example.com';
  14. $subject = 'The subject';
  15. $body = 'The email body content';
  16. $headers = array('Content-Type: text/html; charset=UTF-8');
  17.  
  18. wp_mail( $to, $subject, $body, $headers );
  19.  
  20. remove_filter( 'wp_mail_content_type','wpse27856_set_content_type' );
  21.  
  22. if ( !isset( $content_type ) )
  23. $content_type = 'text/html';
Add Comment
Please, Sign In to add comment