Hello with this script if I uncomment the line $headers .= "Content-Type: text/html; charset=UTF-8\r\n";the server will not send email to external addresses (Internal yes). No errors in log or in console. No trace in exim
Ubunto Cpanel Whm. I tried with PHP 5.6 and 7.4 but same problem
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$to = '[email protected],[email protected]';
$subject = 'Test HTML Email';
$message = '<html><body><strong>Ceci est un test pour vérifier l\'envoi de courriels.</strong></body></html>';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: [email protected]\r\n";
$headers .= "Reply-To: [email protected]\r\n";
//>>>>>>//$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
if(mail($to, $subject, $message, $headers)) {
echo "Email envoyé avec succès à $to\n";
} else {
echo "Échec de l'envoi de l'e-mail à $to\n";
$error = error_get_last();
echo "Erreur de mail : " . $error['message'] . "\n";
}
?>
I tied to search logs or exim trace but I found nothing. In my console I have just :
Échec de l'envoi de l'e-mail à [email protected],[email protected]
Erreur de mail :
If I put only internal mail it works
It's working fine with plain html but with html header and external emails nothing happen