E
E
Evgeniy Samoilenko2014-02-27 15:00:34
PHP
Evgeniy Samoilenko, 2014-02-27 15:00:34

How to solve the problem when sending emails to outlook?

Good day!
I send emails this way.
Everywhere everything is in perfect order (mail.ru, gmail, yandex).

$name = $_POST['name'];
    $phone = $_POST['phone'];
    $email = $_POST['email'];
    $msg = $_POST['msg'];
    $email_to = "[email protected]";

    $mail = '
  
            Имя:'. $name .'
            Телефон:'. $phone .'
            Email:'. $email .'
            Сообщение:'. $msg .'
      
    ';
    $headers= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/plain; charset=\"utf-8\" \r\n";
    $headers .= "From: Euro sito <[email protected]> \r\n";

    $result = mail($email_to, 'Обратная связь', $mail, $headers);

    $link = "Location: ".getenv("HTTP_REFERER");

But if the recipient looks at the letter in outlook, then we get something like this:
хЛЪ:п═я┐я│я│п╨п╦
            рЕКЕТНМ:я┌п╣я│я┌
            Email:я▐п╥я└п╨п╟
            яННАЫЕМХЕ:п╪п╟я└п╟п╨п╟

Send script encoding - utf-8.
If you change it to ANSI - the body of the letter remains the same, but the title (the subject of the letter) is DISPLAYED IN RUSSIAN and is absolutely normal.
Generally. I've been sitting here for 3 hours and I'm pretty nervous. Help me please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew D.Laptev, 2014-02-27
@samoilenkoevgeniy

And if you try this, what will happen?

$result = mail($email_to, "=?utf-8?B?" . base64_encode('Обратная связь') . "?=", $mail, 'Content-type: text/plain; charset="UTF-8"\r\n')

O
Oleg Abarmov, 2014-02-27
@XProx

Try
1.header('Content-Type: text/html; charset=utf-8'); 2.
Set encoding to utf-8 without BOM

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question