Using PHP - Configuring the Right MIME Type

I have a problem with a PHP script that sends confirmation email. When receiving email in Thunderbird, the header comes with the presence of \ r \ n and with the MIME type, which also contains Content-type information. Consequently, the letter is displayed as plain text, not HTML.

If I comment on the MIME type, as shown below, the letter displays correctly. Firstly, is there a significant problem, and secondly, what could be causing this?

if($apptpro_config->html_email == "Yes"){
        //$headers .= 'MIME-Version:1.0\r\n';
        $headers .= 'Content-type:text/html; charset=ISO-8859-1\r\n';
    }   



    return(mail($to, $subject, $message, $headers));
+3
source share
2 answers

, \r\n ( !), PHP

$header = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";

+10
0

Source: https://habr.com/ru/post/1767144/


All Articles