PHP Send UTF-8 mail without PEAR::Mail PEAR::Mail_Mime

后端 未结 3 938
栀梦
栀梦 2021-01-15 12:09

I would like to be able to send e-mails with PHP mail() containing the 8-bit characters åäö. They will be used in the subject, the message and in the \"From:\"-header. How c

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-15 12:32

    $headers = array('From' => $from,
        'To' => "<$to>",
        'Subject' => $subject);
    
    if ($is_html) {
        $headers['Content-type'] = "text/html; charset=UTF-8";
    } else {
        $headers['Content-type'] = "text/plain; charset=UTF-8";
    }
    

    This works for me

提交回复
热议问题