将php邮件发送到特殊字符的电子邮件地址,如äüö;
我使用贝宝API,我需要将php电子邮件发送给电子邮件地址带有特殊字符的收件人。只要我不向ü@example.com、ö@example.com等发送电子邮件,一切都很好……但自2012年以来,这些字符存在于电子邮件地址中,我无法让php正确理解这些字符。有人能帮我吗将php邮件发送到特殊字符的电子邮件地址,如äüö;,php,email,special-characters,Php,Email,Special Characters,我使用贝宝API,我需要将php电子邮件发送给电子邮件地址带有特殊字符的收件人。只要我不向ü@example.com、ö@example.com等发送电子邮件,一切都很好……但自2012年以来,这些字符存在于电子邮件地址中,我无法让php正确理解这些字符。有人能帮我吗 <?php $message = "Bla" $item_name = $_POST['item_name']; $payer_email = $_POST['payer_email'];
<?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);
?>
您需要将其编码为utf8
$to = utf8_encode($_POST['payer_email'];
您需要将其编码为utf8
$to = utf8_encode($_POST['payer_email'];