note 92976 deleted from function.mail by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 11:15:54 +0000 |
| Subject: | note 92976 deleted from function.mail by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197051@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
UTF-8 and QMail
This function should work for all of you, who want to switch to UTF-8 email - especially if using
Qmail as Mailserver.
QMail seems to have problems with the "\r\n" in the header section. I found it helpful to
replace them with "\n".
<?php
function mail_utf8($to, $subject = '(No subject)', $message = '', $from) {
$header = 'MIME-Version: 1.0' . "\n" . 'Content-type: text/plain;
charset=UTF-8'
. "\n" . 'From: Yourname <' . $from . ">\n";
mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header);
}
?>