0
I’m trying to make a form
able to send an email and I’m having a problem understanding how to send the email message in UTF-8, which I managed to do quietly with the subject of the email, but not with the message.
Below is the PHP code:
if(isset($_POST['submit'])){
$name = $_POST['name'];
$mailFrom = $_POST['mail'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$subject = '=?UTF-8?B?'.base64_encode("$subject").'?=';
$mailTo = "[email protected]";
$headers = "From: ".$mailFrom;
$txt = "Foi recebida uma nova mensagem de: ".$name.".\r\n".$message;
mail($mailTo, $subject, $txt, $headers);
header("Location: index.html");
}
Unfortunately it didn’t work, when it includes this code, all it did was change the subject of the email to: Content-Type:text/html; charset=UTF-8.
– Vitor Hugo