I have tried to read up on this issue and checked examples but havent found a way to figure this out. When my confirmation letter is sent to buyer/seller the ÅÄÖ or other special characters will be corrupt and how do I change this? Heres a screenshot: http://snag.gy/7IFDQ.jpg
As you can see both the text and the subject is corrupt.
I have of course changed to utf-8 in the PayPal profile. This is something else. I found a way after a long long time to fix it for the PDT but now the "same" issue is bugging me on the IPN side.
Anyone that knows how to exactly fix this? I can paste IPN.php and Ipnhandler if you want me to.
I found out how you do this, you will need to set UTF-8 in the mail itself and in extension both in the header of the mail (Subject and so on) and the message in the mail as well.
Heres a code sample that sends a mail to the customr and a copy to the seller:
// send user an email with a confirmation
$firstname = $_POST['first_name'];
$lastname = $_POST['last_name'];
$to = filter_var($_POST['payer_email'], FILTER_SANITIZE_EMAIL);
$to2 = filter_var($_POST['[email protected]'], FILTER_SANITIZE_EMAIL);
$subject = "Tack för Ert köp! / Thank you for your order!";
$subject2 = "(COPY) Tack för Ert köp! / Thank you for your order!";
$headerFields = array(
'Date: ' . date('r', $_SERVER['REQUEST_TIME']),
"Subject: =?UTF-8?Q?".imap_8bit($subject)."?=",
"From: {$to}",
"MIME-Version: 1.0",
"Content-Type: text/html;charset=utf-8"
);
$headerFields2 = array(
'Date: ' . date('r', $_SERVER['REQUEST_TIME']),
"Subject: =?UTF-8?Q?".imap_8bit($subject2)."?=",
"From: {$to}",
"MIME-Version: 1.0",
"Content-Type: text/html;charset=utf-8"
);
$message = "$firstname $lastname, $payer_email <br />
MESSAGE TO CUSTOMER;
$message2 = "$firstname $lastname, $payer_email <br />
MESSAGE TO CUSTOMER
(NOTE: THIS IS A COPY)";
mail($to, $subject, $message, implode("\r\n", $headerFields));
mail($to2, $subject2, $message2, implode("\r\n", $headerFields2));
}
What is happening is that the $headerFields "MIME-Version: 1.0", "Content-Type: text/html;charset=utf-8"
sets UTF-8 for the message of the mail. It even applies to the header except for the Subject that needs to be alone set to: "Subject: =?UTF-8?Q?".imap_8bit($subject)."?=",