send mail from php - charset encoding

后端 未结 1 1827
甜味超标
甜味超标 2021-01-20 02:45

I am sending an automated mail,written in Greek, from a php script. I tried:

 $headers  = \"MIME-Version: 1.0\\r\\n\";
$headers .= \"Content-type: text/plain         


        
1条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-20 03:00

    All email headers, which includes the subject, need to be pure ASCII, you cannot use UTF-8 or other encodings directly in email headers. Some mail services may be able to detect other encodings and do the right thing, but it's not technically valid. Encode your headers using MIME encoding, see How to use special characters in recipients name when using PHP's mail function.

    0 讨论(0)
提交回复
热议问题