我正在使用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' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= "From: office@rhythm-one.com \r\n";
$headers .= "Reply-To: office@rhythm-one.com \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
?>
答案 0 :(得分:0)
您需要将其编码为utf8
$to = utf8_encode($_POST['payer_email'];