22 lines
676 B
PHP
22 lines
676 B
PHP
<?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' );
|