2017-10-20 140 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']; 
相關問題