-
-
Save csalzano/fd69d35a99cd5ba68ab72db36cfb63b0 to your computer and use it in GitHub Desktop.
Configure WordPress on Valet to use MailHog
This file contains 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 characters
<?php | |
/** | |
* @link | |
* @since 1.0.0 | |
* @package TODO | |
* | |
* @wordpress-plugin | |
* Plugin Name: Use MailHog | |
* Description: Configure WordPress on Valet to use MailHog | |
* Version: 1.0.0 | |
* Tags: local, email | |
*/ | |
if ( ! function_exists( 'phpmailer_use_mailhog' ) ) { | |
add_action( 'phpmailer_init', 'phpmailer_use_mailhog', 10, 1 ); | |
function phpmailer_use_mailhog( $phpmailer ) { | |
// Define that we are sending with SMTP | |
$phpmailer->isSMTP(); | |
// The hostname of the mailserver | |
$phpmailer->Host = 'localhost'; | |
// Use SMTP authentication (true|false) | |
$phpmailer->SMTPAuth = false; | |
// SMTP port number | |
// Mailhog normally run on port 1025 | |
$phpmailer->Port = defined( 'WP_DEBUG' ) && WP_DEBUG ? '1025' : '25'; | |
// Username to use for SMTP authentication | |
// $phpmailer->Username = 'yourusername'; | |
// Password to use for SMTP authentication | |
// $phpmailer->Password = 'yourpassword'; | |
// The encryption system to use - ssl (deprecated) or tls | |
// $phpmailer->SMTPSecure = 'tls'; | |
// Change the from address | |
// $phpmailer->From = '[email protected]'; | |
// $phpmailer->FromName = 'WP DEV'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment