Last active
August 20, 2025 11:39
-
-
Save butlerblog/c5c5eae5ace5bdaefb5d to your computer and use it in GitHub Desktop.
Revisions
-
butlerblog revised this gist
Jul 19, 2021 . No changes.There are no files selected for viewing
-
butlerblog revised this gist
Sep 28, 2020 . 2 changed files with 9 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,13 @@ <?php /* * Set the following constants in wp-config.php. * These should be added somewhere BEFORE the constant ABSPATH is defined. * * Author: Chad Butler * Author URI: https://butlerblog.com * * For more information and instructions, see: https://b.utler.co/Y3 */ define( 'SMTP_USER', '[email protected]' ); // Username to use for SMTP authentication This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,10 +7,9 @@ * define the using the wp_config.php example in this gist. * * Author: Chad Butler * Author URI: https://butlerblog.com * * For more information and instructions, see: https://b.utler.co/Y3 */ add_action( 'phpmailer_init', 'send_smtp_email' ); function send_smtp_email( $phpmailer ) { -
butlerblog revised this gist
Nov 10, 2018 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,11 @@ */ add_action( 'phpmailer_init', 'send_smtp_email' ); function send_smtp_email( $phpmailer ) { if ( ! is_object( $phpmailer ) ) { $phpmailer = (object) $phpmailer; } $phpmailer->Mailer = 'smtp'; $phpmailer->Host = SMTP_HOST; $phpmailer->SMTPAuth = SMTP_AUTH; $phpmailer->Port = SMTP_PORT; -
butlerblog revised this gist
Aug 8, 2017 . 2 changed files with 28 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ <?php /* * Set the following constants in wp-config.php * These should be added somewhere BEFORE the * constant ABSPATH is defined. */ define( 'SMTP_USER', '[email protected]' ); // Username to use for SMTP authentication define( 'SMTP_PASS', 'smtp password' ); // Password to use for SMTP authentication define( 'SMTP_HOST', 'smtp.example.com' ); // The hostname of the mail server define( 'SMTP_FROM', '[email protected]' ); // SMTP From email address define( 'SMTP_NAME', 'e.g Website Name' ); // SMTP From name define( 'SMTP_PORT', '25' ); // SMTP port number - likely to be 25, 465 or 587 define( 'SMTP_SECURE', 'tls' ); // Encryption system to use - ssl or tls define( 'SMTP_AUTH', true ); // Use SMTP authentication (true|false) define( 'SMTP_DEBUG', 0 ); // for debugging purposes only set to 1 or 2 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,9 @@ * SMTP server. This improves reliability of wp_mail, and * avoids many potential problems. * * Values are constants set in wp-config.php. Be sure to * define the using the wp_config.php example in this gist. * * Author: Chad Butler * Author URI: http://butlerblog.com * @@ -11,28 +14,13 @@ */ add_action( 'phpmailer_init', 'send_smtp_email' ); function send_smtp_email( $phpmailer ) { $phpmailer->isSMTP(); $phpmailer->Host = SMTP_HOST; $phpmailer->SMTPAuth = SMTP_AUTH; $phpmailer->Port = SMTP_PORT; $phpmailer->Username = SMTP_USER; $phpmailer->Password = SMTP_PASS; $phpmailer->SMTPSecure = SMTP_SECURE; $phpmailer->From = SMTP_FROM; $phpmailer->FromName = SMTP_NAME; } -
butlerblog revised this gist
Apr 5, 2015 . 1 changed file with 23 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,27 +12,27 @@ add_action( 'phpmailer_init', 'send_smtp_email' ); function send_smtp_email( $phpmailer ) { // Define that we are sending with SMTP $phpmailer->isSMTP(); // The hostname of the mail server $phpmailer->Host = "smtp.example.com"; // Use SMTP authentication (true|false) $phpmailer->SMTPAuth = true; // SMTP port number - likely to be 25, 465 or 587 $phpmailer->Port = "587"; // Username to use for SMTP authentication $phpmailer->Username = "yourusername"; // Password to use for SMTP authentication $phpmailer->Password = "yourpassword"; // Encryption system to use - ssl or tls $phpmailer->SMTPSecure = "tls"; $phpmailer->From = "[email protected]"; $phpmailer->FromName = "Your Name"; } -
butlerblog created this gist
Apr 5, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ /** * This function will connect wp_mail to your authenticated * SMTP server. This improves reliability of wp_mail, and * avoids many potential problems. * * Author: Chad Butler * Author URI: http://butlerblog.com * * For more information and instructions, see: * http://b.utler.co/Y3 */ add_action( 'phpmailer_init', 'send_smtp_email' ); function send_smtp_email( $phpmailer ) { // Define that we are sending with SMTP $phpmailer->isSMTP(); // The hostname of the mail server $phpmailer->Host = "smtp.example.com"; // Use SMTP authentication (true|false) $phpmailer->SMTPAuth = true; // SMTP port number - likely to be 25, 465 or 587 $phpmailer->Port = "587"; // Username to use for SMTP authentication $phpmailer->Username = "yourusername"; // Password to use for SMTP authentication $phpmailer->Password = "yourpassword"; // Encryption system to use - ssl or tls $phpmailer->SMTPSecure = "tls"; $phpmailer->From = "your-email-address"; $phpmailer->FromName = "Your Name"; }