I searched and searched for a solution for this, but to no avail.
I am using the php mailer to send mixed text / html email encoded in utf8. Here is the relevant code:
$headers = "From: $fromPerson\r\n" . "Content-Transfer-Encoding: 8bit\r\n". "Reply-To: $fromPerson\r\n" . "Content-Type: multipart/alternative; boundary=". $mime_boundary_header. "\r\n" . "X-Mailer: PHP/" . phpversion(); $message = "$notice_text --$mime_boundary Content-Type: text/plain; charset='UTF-8' Content-Transfer-Encoding: 8bit $textEmail --$mime_boundary Content-Type: text/html; charset='UTF-8' Content-Transfer-Encoding: 8bit $htmlEmail --$mime_boundary--"; //mb_detect_encoding($message) returns UTF-8 $mail_sent = @mail( $to, $subject, $message, $headers);
Messages contain Spanish along with these tricky characters. Email messages are perfectly displayed in gmail, hotmail (online prospects), mac mail, phones, etc., but not in direct Windows or Microsoft Outlook mail.
If I manually set the default font in Windows Live Mail in utf8, the message will display correctly, but otherwise it will not. If I forward an email from another client to Outlook or to Windows Live, it also displays great.
I could find work around, I'm sure, but am I missing something? I donβt want to rely on receivers, knowing how to change the encoding of the message, so is there something I need to add to the letter in order to encourage these clients to recognize the encoding?
I apologize if this has been considered elsewhere and I would appreciate any advice. It seems like I should just go and use PHPMailer to see if this fixes the problem, but out of personal curiosity it would be interesting to know why this is happening ...
source share