S
S
Shenku2016-12-26 16:28:22
PHP
Shenku, 2016-12-26 16:28:22

Why is the encoding displayed differently?

V2Ve0Y6ilG1wmv.jpg
files in utf8 headers in utf8 meta utf8 but in the letter itself there is such garbage, and this is Windows Live Mail, for example, on the same Yandex, if you enter from the site, everything is fine. Who can come across?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2016-12-26
@Sh3nku

The "Subject" header is not affected by encoding headers. It must be explicitly specified in the Subject via inline. If it is not specified, different systems treat non-ASCII characters in this field differently. At one time it was considered the de facto standard to perceive it in KOI-8R. Specify encoding explicitly per RFC-2047

S
Shenku, 2016-12-26
@Sh3nku

yes, it's actually a function. Forgot to post it

function send_mail($email, $theme, $text) {
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "From: TK-TAT.ru <[email protected]>\r\n";
    $headers .= "Reply-To: [email protected]\r\n";
    $headers .= "Content-type: text/html; charset=UTF-8\r\n";
    $headers .= "X-Mailer: PHP/" . phpversion();

    $text = '
        <html>
            <head>
                <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
            </head>
            <body>
                '.$text.'
            </body>
        </html>
    ';

    mail($email, "TK-TAT.ru - ".$theme, $text, $headers);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question