Last active
November 7, 2018 18:41
-
-
Save joedooley/35a39bb412e1e2281b81d20d08a6aedd to your computer and use it in GitHub Desktop.
Route all WordPress email through MailHog.
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 characters
<?php | |
/** | |
* Plugin Name: MailHog Config | |
* Description: Route all WordPress email through MailHog. | |
* Version: 1.0.0 | |
* | |
* @package LuminFire\MailHog | |
* @since 1.0.0 | |
* @author LuminFire | |
* @link https://luminfire.com/ | |
*/ | |
namespace LuminFire\MailHog; | |
/** | |
* Routes all mail through Mailhog. | |
* | |
* @since 1.0.0 | |
* | |
* @param $phpmailer | |
* | |
* @return void | |
*/ | |
add_action( 'phpmailer_init', function ( $phpmailer ) { | |
if ( isset( $_ENV['PANTHEON_ENVIRONMENT'] ) ) { | |
return; | |
} | |
$phpmailer->isSMTP(); | |
$phpmailer->Host = 'localhost'; | |
$phpmailer->SMTPAuth = false; | |
$phpmailer->Port = '1025'; | |
$phpmailer->From = '[email protected]'; | |
$phpmailer->FromName = 'MN Grown - Local Dev Environment'; | |
// $phpmailer->Username = 'yourusername'; | |
// $phpmailer->Password = 'yourpassword'; | |
// $phpmailer->SMTPSecure = 'tls'; | |
}, 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment