I am trying to use Mailtrap to test emails sent from my localhost environment (Wordpress running on Xampp, Mac OS).
I implemented the code mailtrap gave me, into functions.php:
function mailtrap($phpmailer) {
$phpmailer->isSMTP();
$phpmailer->Host = 'smtp.mailtrap.io';
$phpmailer->SMTPAuth = true;
$phpmailer->Port = 2525;
$phpmailer->Username = '***-cd4b';
$phpmailer->Password = '***-239a';
}
add_action('phpmailer_init', 'mailtrap');
I made a php file where I try to send the email with this code:
$to = "benviat@gmail.com";
$subject = 'my subject';
$message = 'I would like to work with you';
$headers[] = 'From: Ben<bviatte@gmail.com>';
$sent_message = wp_mail( $to, $subject, $message, $headers);
var_dump($sent_message);
if ( $sent_message ) {
echo 'The test message was sent. Check your email inbox.';
} else {
echo 'The message was not sent';
}
However, all I get is a "This message was not sent".
When I check the error logs, what I get is a: AH00169: caught SIGTERM, shutting down
as well as a: AH01906: localhost:443:0 server certificate is a CA certificate
Any advice would be greatly appreciated!