Answer the question
In order to leave comments, you need to log in
Unrecognizable encoding of mail coming from the site?
Friends, good afternoon!
All pages of the site (under Linux hosting) are in UTF-8, which, of course, is spelled out (the beginning of the HTML:
<!DOCTYPE html>
<html lang="ru-RU" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
.......
<?php
$errors = array();
if (!isset($_POST['name'])) {
$errors['name'] = 'Введите, пожалуйста, своё имя.';
}
if (!isset($_POST['email']) || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
$errors['email'] = 'Введите, пожалуйста, адрес своей электронной почты';
}
if (!isset($_POST['message'])) {
$errors['message'] = 'Напишите, пожалуйста, откуда Вы узнали о нас';
}
$errorOutput = '';
if(!empty($errors)){
$errorOutput .= '<div class="alert alert-danger alert-dismissible" role="alert">';
$errorOutput .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
$errorOutput .= '<ul>';
foreach ($errors as $key => $value) {
$errorOutput .= '<li>'.$value.'</li>';
}
$errorOutput .= '</ul>';
$errorOutput .= '</div>';
echo $errorOutput;
die();
}
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = $email;
$to = '[email protected]';
$subject = 'Contact Form : Anton';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
$headers = "From: ".$from;
$result = '';
if (mail ($to, $subject, $body, $headers)) {
$result .= '<div class="alert alert-success alert-dismissible" role="alert">';
$result .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
$result .= 'Спасибо за подписку!
';
$result .= '</div>';
echo $result;
die();
}
$result = '';
$result .= '<div class="alert alert-danger alert-dismissible" role="alert">';
$result .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
$result .= 'Something bad happend during sending this message. Please try again later';
$result .= '</div>';
echo $result;</b>
Answer the question
In order to leave comments, you need to log in
Try adding this
$body .= "Content-type: text/html; charset='utf-8'\n";
Thank you, Valentin. Did not help.
I tried to change the e-mail address
, so on yandex.ru it turns out, for some reason, letters do not come at all ...!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question