Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <?php
  2. /**
  3. * Update variable settings.
  4. * Load to your WP root folder.
  5. */
  6.  
  7. // Set $to as the email you want to send the test to
  8.  
  9. $subject = 'wp_mail function test';
  10.  
  11. $message = '------=_Part_18243133_1346573420.1408991447668
  12. Content-Type: text/plain; charset=UTF-8
  13.  
  14. Hello world! This is plain text...
  15.  
  16.  
  17. ------=_Part_18243133_1346573420.1408991447668
  18. Content-Type: text/html; charset=UTF-8
  19.  
  20. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  21. <html xmlns="http://www.w3.org/1999/xhtml">
  22. <head>
  23. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  24. </head>
  25. <body>
  26.  
  27. <p>Hello World! This is HTML...</p>
  28.  
  29. </body></html>
  30.  
  31.  
  32. ------=_Part_18243133_1346573420.1408991447668--';
  33.  
  34. $headers = "MIME-Version: 1.0\r\n";
  35. $headers .= "From: Foo <[email protected]>\r\n";
  36. $headers .= 'Content-Type: multipart/alternative;boundary="----=_Part_18243133_1346573420.1408991447668"';
  37.  
  38.  
  39.  
  40.  
  41. // Load WP components, no themes
  42. define('WP_USE_THEMES', false);
  43. require('wp-load.php');
  44.  
  45. // Call the wp_mail function, display message based on the result.
  46. if( wp_mail( $to, $subject, $message, $headers ) ) {
  47. // the message was sent...
  48. echo 'The test message was sent. Check your email inbox.';
  49. } else {
  50. // the message was not sent...
  51. echo 'The message was not sent!';
  52. };
  53. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement