Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
339
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. $to = "your@email.com";
  9.  
  10. $subject = 'wp_mail function test';
  11.  
  12. $message = '------=_Part_18243133_1346573420.1408991447668
  13. Content-Type: text/plain; charset=UTF-8
  14.  
  15. Hello world! This is plain text...
  16.  
  17.  
  18. ------=_Part_18243133_1346573420.1408991447668
  19. Content-Type: text/html; charset=UTF-8
  20.  
  21. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  22. <html xmlns="http://www.w3.org/1999/xhtml">
  23. <head>
  24. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  25. </head>
  26. <body>
  27.  
  28. <p>Hello World! This is HTML...</p>
  29.  
  30. </body></html>
  31.  
  32.  
  33. ------=_Part_18243133_1346573420.1408991447668--';
  34.  
  35. $headers = "MIME-Version: 1.0\r\n";
  36. $headers .= "From: Foo <foo@bar.com>\r\n";
  37. $headers .= 'Content-Type: multipart/alternative;boundary="----=_Part_18243133_1346573420.1408991447668"';
  38.  
  39.  
  40.  
  41.  
  42. // Load WP components, no themes
  43. define('WP_USE_THEMES', false);
  44. require('wp-load.php');
  45.  
  46. // Call the wp_mail function, display message based on the result.
  47. if( wp_mail( $to, $subject, $message, $headers ) ) {
  48. // the message was sent...
  49. echo 'The test message was sent. Check your email inbox.';
  50. } else {
  51. // the message was not sent...
  52. echo 'The message was not sent!';
  53. };
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement