mailhog
This commit is contained in:
21
mu-plugins/mailhog.php
Normal file
21
mu-plugins/mailhog.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Route all outgoing mail through the local mailhog service (see devenv.nix)
|
||||
* instead of actually sending it. View caught mail at http://localhost:8025.
|
||||
*/
|
||||
|
||||
add_action(
|
||||
'phpmailer_init',
|
||||
function ( $phpmailer ) {
|
||||
$phpmailer->isSMTP();
|
||||
$phpmailer->Host = '127.0.0.1';
|
||||
$phpmailer->Port = 1025;
|
||||
$phpmailer->SMTPAuth = false;
|
||||
$phpmailer->SMTPAutoTLS = false;
|
||||
}
|
||||
);
|
||||
|
||||
// WordPress defaults the From address to "wordpress@localhost" in this
|
||||
// environment, which PHPMailer rejects as invalid (no dot in the domain),
|
||||
// causing wp_mail() to fail before it ever reaches mailhog.
|
||||
add_filter( 'wp_mail_from', fn() => 'wordpress@wp-devenv.test' );
|
||||
Reference in New Issue
Block a user