UTF-8, PHP - Some Mail Clients

Hi,

I’ve been looking around for a solution to this problem with no luck - I’m hoping you guys can help.

I have an autoresponder e-mail that sends a follow up to the customer. I had all sorts of issues trying to get to embed UTF characters - which I thought I’d manged to solve, except it’s inconsistent across mail clients.

The first part (the autoresponder to the admin) always sends the characters correctly to all mail clients I have tested on - the second part sends correctly to most mail clients except at the moment not to MS Office 98, where the follow up (the second part) is garbled.

Can anyone see if there is something I’ve missed? The two parts of the code appear identical to me - so I don’t know what I’m doing wrong. It was a struggle for me to get this far - but I’ve been determined to work it out myself.

<?php
$charset='UTF-8';
$myEmail = $_POST['$myEmail'];
$userIP = $_SERVER[REMOTE_ADDR];
$to ="[email protected]";
$subject='?????? ??? company.';
$encoded_subject="=?$charset?B?".base64_encode($subject)."?=n";
$body='???? ???
???? ?? ????? ?????? ?? ???????? ??????????? ??????? ?? ?? company.
??? ???????? ????????? ?? ??? ????? ';
$headers="From: ".$myEmail."n"

    . "Content-Type: text/plain; charset=$charset; format=flowedn"

    . "MIME-Version: 1.0n"

    . "Content-Transfer-Encoding: 8bitn"

    . "X-Mailer: PHPn";

mail($to,$encoded_subject, $body,$headers);
$subject_r = '??? ???????????? ??? ?? ?????????? ??? ??? ?? company';
$encoded_subject_r="=?$charset?B?".base64_encode($subject_r)."?=n";


$body_r ='???? ???
??? ???????????? ??? ?? ?????????? ??? ??? ??  ?? ????????????? ??? ??????????? ??? ????????? ???? ?? 
???????? ?? ??? ????????? ?? ????????? ??? ??? ??????????? ??? ????????? ??? ????? ?????? ???? ?? ???????? ??? 
???????????? ??????? 
???/??? 23333-33333 
???. 6966266691-66
Email: [email protected] 
?????? ?????????? ??????? 25522-22222
??????? ????????????? ??????, WWF ?????-????????? ??????, ???/???. 2554-32210, Email: company.gr
????. 21140-88888
???.  21140-22222
?????? ??????  21140-33333';

mail($myEmail, $encoded_subject_r,$body_r,"From:[email protected]");  

echo "SentOK=" . $sentOK;

?>

Any help warmly appreciated!

Sponsor our Newsletter | Privacy Policy | Terms of Service