duan7007 2011-09-01 06:57
浏览 270

如何发送UTF-8电子邮件?

When I send out the email, the email does not show characters other than english. It does show like below:

余生ä»ä»

May know actually what cause this? Even I tried to added Content-type and charset in the script, it still show the same.

I used Mail::Factory("mail");

  • 写回答

2条回答 默认 最新

  • dsfdgdsfd23212 2011-09-01 07:33
    关注

    You can add header "Content-Type: text/html; charset=UTF-8" to your message body.

    $headers = "Content-Type: text/html; charset=UTF-8";
    

    If you use native mail() function $headers array will be the 4th parameter mail($to, $subject, $message, $headers)

    If you user PEAR Mail::factory() code will be:

    $smtp = Mail::factory('smtp', $params);
    
    $mail = $smtp->send($to, $headers, $body);
    
    评论

报告相同问题?