我正在使用PayPal API,我需要将 php 电子邮件发送给具有特殊字符电子邮件地址的收件人。只要我不向 ü@example.com 发送电子邮件,ö@example.com 等等,一切正常......但自 2012 年以来,这些字符存在于电子邮件地址中,我无法让 php 正确理解这些字符。有人可以帮助我???
<?php
$message = "Bla"
$item_name = $_POST['item_name'];
$payer_email = $_POST['payer_email'];
$email_from = 'office@rhythm-one.com';
address
$email_subject = '=?UTF-8?
B?'.base64_encode('Bestellbestätigung').'?=';
$email_body = "$message";
$to = $_POST['payer_email'];//<== This could contain ä,ü or ö
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=UTF-8' . "rn";
$headers .= "From: office@rhythm-one.com rn";
$headers .= "Reply-To: office@rhythm-one.com rn";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
?>
你需要把它编码成utf8
$to = utf8_encode($_POST['payer_email'];