N
N
Nikolay2017-10-23 06:37:51
PHP
Nikolay, 2017-10-23 06:37:51

What could be the problem with encoding in Joomla?

Hello. Made feedback for the site. Everything works, messages come, but the problem is that they come in krakozyabry. The main thing is that everything is displayed normally in the description of the letter, and when you open the krakozyabry. It's about the encoding, but I checked the same encoding everywhere. How can I fix this so that the message is displayed in Russian letters?
I am attaching parts of the file code (encodings in the file and feedback code)

<?php defined('_JEXEC') or die; header("Content-Type: text/html; charset=utf-8");?>

<div id="openModal" class="modalDialog">
  <div>
    <a href="#close" title="Закрыть" class="close">X</a>
    <h2>Модальное окно</h2>
      <form name="MyForm" action="#openModal" method="post"><br>
      <input name="name" type="text" placeholder="Имя" /><br>
      <input name="tel" type="phone" placeholder="Телефон" /><br>
      <input name="email" type="email" placeholder="Email" /><br>
      <textarea name="body"  placeholder="Ваше сообщение"></textarea><br>
      <input type="submit" value="Отправить заявку" id="btnpng4" />
      </form>
      <?php
      if (isset($_POST["email"])){
      if (isset($_POST["name"])) {$name = $_POST["name"];}
      if (isset($_POST["email"])) {$email = $_POST["email"];}
      if (isset($_POST["tel"])) {$tel = $_POST["tel"];}
      if (isset($_POST["body"])) {$body = $_POST["body"];}

      if($name=="" or $email=="" or $tel=="" or $body==""){ // Проверяем на заполненность всех полей.
        echo "Заполните все поля";
      }else{
        $ip=$_SERVER["REMOTE_ADDR"]; // Вычисляем ip пользователя
        $brose=$_SERVER["HTTP_USER_AGENT"]; // Вычисляем браузер пользователя
      $to = "email"; // Ваш email адрес
      $subject = "Сообщение c сайта СибКом"; // тема письма 
      $headers .= "Content-Type: text/html; charset=utf-8";
      $headers .= "From: Создание сайтов Trust Code"; // Отправитель письма
      $message = "
      Имя: $name<br>
      E-mail: $email<br>
      Телефон: $tel<br>
      Текст: $body<br><br>

      
      IP отправителя: $ip<br>
      Браузер отправителя: $brose<br>
      "; 
      $send = mail($to, $subject, $message, $headers);


       if ($send == "true")
       {
       echo "Ваше сообщение отправлено. Мы ответим вам в ближайшее время.";
       }
       else
       {
       echo "Не удалось отправить, попробуйте снова!";
       }
      }
      }
      ?>
  </div>
</div>

Also a screenshot of the form in which the letter arrives in the mail.
59ed63d60b065178422556.jpeg59ed63ea027d0025487432.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2017-10-23
@Semenov-Nikolay

$headers .= "Content-Type: text/html; charset=utf-8";
$headers .= "From: Создание сайтов Trust Code"; // Отправитель письма

And who will add new line breaks between lines? Your lines are stuck together

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question