I have this weird error where if I paste in a string that contains “á” and “é” (in any part of the string) to the HTML of the email, it won’t send the email. There might be other character combos, that’s what I found flawy. It looks like this:
$name = "áé";
$email = "[email protected]";
$htmlContent = '
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
</head>
<body>
<h3>Dear ' . $name. '!</h3> //error if $name contains both "á" and "é", otherwise email is sent
</body>
</html>
';
$headers = "MIME-Version: 1.0" . "rn";
$headers .= "Content-type:text/html;charset=UTF-8" . "rn";
$headers .= "From: ... rn";
$headers .= "Reply-To: ... rn";
if (mail($email, $subject, $htmlContent, $headers))
I tried strval() and mb_encode_mimeheader(), now I’ll try replacing “á” and “é” if $name contains it, but that’s not too dynamic and perfecct solution.