Character Encoding in Sending Email and PHP

前端 未结 2 953
离开以前
离开以前 2021-01-24 22:01

I have a simple contact page that sends email with contact data with code below. But I can not read any of them because the characters are not readable. Based on my website cont

2条回答
  •  隐瞒了意图╮
    2021-01-24 22:36

    Don't go with your own solutions to compose and send email, you are likely to get it wrong. Use some email class, for example PHPMailer. There just set CharSet property:

    $mailer = new PHPMailer();
    $mailer->CharSet = 'utf-8';
    

    Or [swiftmailer][2], or Pear's Mail Mime

提交回复
热议问题