Skip to content

Instantly share code, notes, and snippets.

@insanedefaults
Forked from butlerblog/test_wp_mail.php
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save insanedefaults/aeddbc3895c220a8f0a3 to your computer and use it in GitHub Desktop.

Select an option

Save insanedefaults/aeddbc3895c220a8f0a3 to your computer and use it in GitHub Desktop.

Revisions

  1. @butlerblog butlerblog revised this gist Apr 21, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion calling_wp_mail.php
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    <?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?>
  2. @butlerblog butlerblog renamed this gist Apr 21, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @butlerblog butlerblog revised this gist Apr 21, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions using_wp_mail.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?>
  4. @butlerblog butlerblog revised this gist Apr 6, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion test_wp_mail.php
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@
    require('wp-load.php');

    // send test message using wp_mail function
    $send_message = wp_mail( $to, $subject, $message, $headers );
    $sent_message = wp_mail( $to, $subject, $message, $headers );

    //display message based on the result.
    if ( $sent_message ) {
  5. @butlerblog butlerblog revised this gist Apr 5, 2015. 1 changed file with 9 additions and 2 deletions.
    11 changes: 9 additions & 2 deletions test_wp_mail.php
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,14 @@
    <?php
    /**
    * Update variable settings.
    * Load to your WP root folder.
    * This file can be used to validate that the WordPress wp_mail() function is working.
    * To use, change the email address in $to below, save, and upload to your WP root.
    * Then browse to the file in your browser.
    *
    * For full discussion and instructions, see the associated post here:
    * http://b.utler.co/9L
    *
    * Author: Chad Butler
    * Author URI: http://butlerblog.com/
    */

    // Set $to as the email you want to send the test to
  6. @butlerblog butlerblog created this gist Apr 5, 2015.
    31 changes: 31 additions & 0 deletions test_wp_mail.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    <?php
    /**
    * Update variable settings.
    * Load to your WP root folder.
    */

    // Set $to as the email you want to send the test to
    $to = "you@yourdomain.com";

    // 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');

    // send test message using wp_mail function
    $send_message = wp_mail( $to, $subject, $message, $headers );

    //display message based on the result.
    if ( $sent_message ) {
    // 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!';
    }