2017-10-20 120 views
0

我正在使用paypal API,并且需要将php电子邮件发送给有特殊字符的电子邮件地址的收件人。只要我不发送电子邮件到ü@example.com,ö@example.com等......所有工作都正常,但自2012年以来,这些角色存在于电子邮件地址中,我无法使用PHP来理解这些charakters对。有人可以帮助我?将php邮件发送到特殊字符电子邮件地址,例如:

<?php 
    $message = "Bla" 
    $item_name = $_POST['item_name']; 
    $payer_email = $_POST['payer_email']; 

    $email_from = '[email protected]'; 
    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: [email protected] \r\n"; 
    $headers .= "Reply-To: [email protected] \r\n"; 
    //Send the email! 
    mail($to,$email_subject,$email_body,$headers); 
    ?> 

回答

0

您需要将其编码为utf8

$to = utf8_encode($_POST['payer_email']; 
相关问题