php
  • email
  • encoding
  • hotmail
  • 2011-08-25 3 views 3 likes 
    3

    다음 코드를 사용하여 내 회원에게 이메일을 보내고 있습니다. 스크립트가 작동하고 사용자가 전자 메일을 수신합니다. 그러나 Hotmail이나 Notes로 이메일을 보낼 때 인코딩 문제가 발생합니다.PHP로 이메일을 Hotmail로 보낼 때 인코딩 문제가 발생했습니다.

    코드 :

    $to  = "[email protected]"; 
    $headers = 'MIME-Version: 1.0' . "\r\n"; 
    $headers .= 'Content-type: text/plain; charset="utf-8"; format="flowed"' . "\r\n"; 
    $headers .= 'Content-Transfer-Encoding: 8bit'. "\n\r\n"; 
    $headers .= "To: John Doe<[email protected]>" . "\r\n" . 
    "From: John Smith<[email protected]" . "\r\n" . 
    "Reply-To: [email protected]" . "\r\n" . 
    "Return-Path: [email protected]" . "\r\n" . 
    "Sender: [email protected]" . "\r\n" . 
    "X-Sender: [email protected]" . "\r\n" . 
    "X-Mailer: JohnDoe". "\r\n". 
    "X-Report-Abuse: Please report abuse to: [email protected]"; 
    
    //If the e-mail was successfully sent... 
    $subject = $translation[104]; 
    if(mail($to, $subject, $message, $headers)){ 
    
    } 
    

    메시지 모두 피사체가 스웨덴어 문자 A, A와 Ö이 포함되어 있습니다. 실제 메시지는 올바르게 인코딩되고 Hotmail에서 볼 수 있지만 제목은 표시되지 않습니다. 당신은 자세한 내용은 아래 이미지를 볼 수 있습니다

    이미지 : http://www.aspkoll.se/imgo/649

    내가 혼란 스러워요. 나는 며칠 동안 봤어 다른 종류의 솔루션을 시도했지만 성공하지 않고 나는 두렵다.

    이 문제를 해결해 주시겠습니까?

    감사!

    +1

    가능한 중복 [어떻게 보낼를 PHP를 사용하여 메일 제목에 이진 단어가 포함 된 메일] (http://stackoverflow.com/questions/1450846/how-to-send-mail-with-binary-word-in-mail-subject-using-php) –

    +0

    메일 헤더에 ASCII가 아닌 문자가 있어야합니다. 규칙에 위배됩니다. – tchrist

    답변

    6

    이메일 과목 및 기타 헤더 내용은 다음과 같은 예를 제공 mail()RFC 2047

    php.net 주석을 사용하여 인코딩됩니다

    mail($mail, "=?utf-8?B?".base64_encode ($subject)."?=", $message, $headers); 
    
    +0

    감사합니다. 그것은 나를 많이 도왔다! – Shubbi

    -1

    시도 http://www.phpclasses.org/browse/file/919.html. 그것은 야후 메일, Gmail, 핫메일에서 작동합니다.

    피. 에스. : 핫메일. : 같은 이름과 같은

     관련 문제

    • 관련 문제 없음^_^