On Sun, 2009-03-08 at 14:17 +0900, Darren Cook wrote:
> > function sendEmail($to, $from, $subject, $message) {
> > $header = 'From: ' . $from . "\r\n" . 'Reply-To: ' . $from . "\r\n" .
> > 'X-Mailer: PHP/' . phpversion();
> > $header .= "\nContent-Type: text/plain; charset=UTF-8";
> > $header .= "\nContent-transfer-encoding: quoted-printable\n";
> >
> > $subject = utf8_decode($subject);
> > $subject = mb_encode_mimeheader($subject,
> > mb_internal_encoding(),"B","\n");
> > return mail('[email protected]', $subject, $message, $header);
> > }
>
> Does dropping the "quoted-printable" header make any difference? As far
> as I can see you are sending actual 8-bit UTF-8, not quoted-printable.
Hi Darren :)
Or, the other way around, is the $message really encoded with
"quoted-printable"? (example: $message =
quoted_printable_encode($message);)
I doubt, as the function 'quoted_printable_encode()' is available only
from PHP version 5.3.0 and most PHP installations still are 5.2.
You could use base64 encoding at the place of quoted printable:
When sending the string "Umlaute: äüöÄÜÖ" as subject and body using my
"evolution" mail program it gets encoded in the following way:
[...]
Subject: Umlaute: =?ISO-8859-1?Q?=E4=FC=F6=C4=DC=D6?=
[...]
Content-Type: text/plain; charset=UTF-8
[...]
Content-Transfer-Encoding: base64
[...]
VW1sYXV0ZTogw6TDvMO2w4TDnMOWDQoNCg==
So you could try "Q" for "Quoted-Printable" at the place of "B" for
"Base64" when encoding the subject, and "base64" as transfer encoding.
Of course you first have to encode the "$message" with something like
'$message = base64_encode($message);' (which should be available even on
older PHP installations).
Nowadays probably most of the internet can deal with 8-bit encodings
like UTF-8. But with base64 you can be sure that the content doesn't
get messed up during the mail transfer at least.
Dietrich
> > This is what I had found some day in order to send UTF-8-encoded emails.
> > Here with WindowsXP/Thunderbird everything works fine. But a friend of
> > mine using some Windows and some Outlook will always receive srumbled
> > german umlauts...
>
> As you didn't say explicitly, have you confirmed he can receive an email
> (e.g. sent by thunderbird) in UTF-8 encoding, with umlauts, and it
> displays okay?
>
> If so, send both versions to yourself (i.e. sent by thunderbird, and
> sent by PHP mail()) and look at the source to see what is different.
>
> Darren
>
>
>
> --
> Darren Cook, Software Researcher/Developer
> http://dcook.org/mlsn/ (English-Japanese-German-Chinese-Arabic
> open source dictionary/semantic network)
> http://dcook.org/work/ (About me and my work)
> http://dcook.org/blogs.html (My blogs and articles)
>
--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php