S
S
sw0rl0k2015-07-07 16:02:06
PHP
sw0rl0k, 2015-07-07 16:02:06

How to specify the encoding of the letter in php?

It was necessary to make a simple feedback form on the site. I don't understand PHP at all. Therefore, I looked for the code as simply as possible, adapted it to my needs and everything works. Sends letters correctly, but without specifying the encoding. And readable messages also come to the mail, but in Thunderbird come krakozyabry. Can you please tell me how to correctly specify the encoding for the code I have? I did not find anything that would work in my case.
PHP code:

<?php
    $name = $_POST['name'];
    $phone = $_POST['phone'];
    $message = $_POST['message'];
    $from = 'From: From'; 
    $to = '[email protected]'; 
    $subject = 'Recall';
  
    $body = "Имя: $name\nТелефон: $phone\nКомментарий:\n$message";
  
    if ($_POST['submit']) {
    if (mail ($to, $subject, $body, $from)) { 
        echo '<p>Ваша заявка принята! Ожидайте звонка!</p>';
    } else { 
        echo '<p>Что-то пошло не так, повторите попытку еще раз!</p>'; 
    }
}
?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question