Answer the question
In order to leave comments, you need to log in
Mail() wrong encoding?
Hello, I send the form to the mail with the following code
if (isset($_POST['send1'])) {
$body = "Форма обратной связи \r\n\r\nИмя: ".$_POST['name']."\r\nТелефон: ".$_POST['phone'];
$subject = "Форма обратной связи CellGSM";
$adress = '[email protected]';
mail($adress, $subject, $body);
echo "<center><h1>Мы с вами свяжемся :)</h1></center>";
}
Answer the question
In order to leave comments, you need to log in
Good evening.
Add a header that will specify the desired encoding.
$headers .= "Content-type: text/html; charset=\"utf-8\"\n";
Because it is necessary to comply with the RFC www.faqs.org/rfcs/rfc2047.html
In order not to reinvent the wheel, use ready-made libraries. For example pear.php.net/package/Mail_Mime , https://github.com/PHPMailer/PHPMailer or similar
You need to use libraries to send emails, then there will be no problems.
For example PHPMailer or swiftmailer.org
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question