Skip to content

Instantly share code, notes, and snippets.

@lunaroja
Created April 22, 2015 05:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lunaroja/d7ea63f66f83f018f1b8 to your computer and use it in GitHub Desktop.
Save lunaroja/d7ea63f66f83f018f1b8 to your computer and use it in GitHub Desktop.
wp_mail function test
<?php
/**
* Update variable settings.
* Load to your WP root folder.
*/
// Set $to as the email you want to send the test to
$to = "";
// No need to make changes below this line
// Email subject and body text
$subject = 'wp_mail function test';
$message = 'This is a test of the wp_mail function: wp_mail is working';
$headers = '';
// Load WP components, no themes
define('WP_USE_THEMES', false);
require('wp-load.php');
// Call the wp_mail function, display message based on the result.
if( wp_mail( $to, $subject, $message, $headers ) ) {
// the message was sent...
echo 'The test message was sent. Check your email inbox.';
} else {
// the message was not sent...
echo 'The message was not sent!';
};
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment