2014-05-09 35 views
-1

我一個面臨的問題使用新的PHPMailer() 我想送ÂĂÃŢŢÎŞŞâăãţţîşş字符作爲主題名稱或名稱,但它不工作,以發送電子郵件......PHP Mailer中的外語字符主題。

function SendFormattedEmailContact2($to, $name='', $subject, $msg, $From, $FromEmail, $BCC_email='') 
{ 

    $sendDate = date("l j, F Y"); 
    $sendDate = str_replace(
     array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), 
     array('Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Iunie', 'Iulie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie'), 
     $sendDate 
    ); 
    $sendDate = str_replace(
     array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'), 
     array('Duminica', 'luni', 'marți', 'miercuri', 'joi', 'Vineri', 'Sâmbătă'), 
     $sendDate 
    ); 

    $msg=str_replace("##date##",date("l jS \of F Y"),$msg); 

    $mailMsg = $msg; 
    $mail = new PHPMailer(); 
    $mail->IsMail(); 
    //$mail->Host="mail.us.hypervibe.com"; 
    $mail->IsHTML(true); 
    $mail->CharSet = 'ISO-8859-2'; 
    $mail->AddAddress($to); 

    if($BCC_email != '') 
     $mail->AddBCC($BCC_email); 

    $mail->AddReplyTo($FromEmail); 
    // $mail->Subject = "=?ISO-8859-2?B?".base64_encode($subject)."?="; 
    $mail->Subject = mb_convert_encoding($subject, "ISO-8859-2", "auto");; 

    $mail->Body = $mailMsg; 
    $mail->From = $FromEmail; 
    //$mail->FromName = "=?ISO-8859-2?B?".base64_encode($From)."?="; 
    $mail->FromName = "=?ISO-8859-2?B?".base64_encode($From)."?="; 
    $mail->AltBody = $mailMsg; 
    $mail->Encoding = "7bit"; 
    return $mail->Send(); 
} 

回答

0
$mail->CharSet = 'UTF-8'; 
$mail->Subject = 'âăãțţîșş'; 

即工作對我來說

+0

但我的概率不是固定在這...我仍然面臨着這些問題... – user3615033