Re: character set when sending emails with PHP
| From: | Manuel Lemos | Date: | Tue, 29 Aug 2006 19:11:29 +0000 |
| Subject: | Re: character set when sending emails with PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241194@lists.php.net to get a copy of this message | ||
Hello,
on 08/29/2006 09:04 AM Angelo Zanetti said the following:
> I have various PHP CRONTAB scripts that run and send automated emails to
> people, the subject often contains the "TM" character: ™, in most of the
> email clients the character shows correctly but in some webmail
> applications the character is replaced with a square, it obviously
> doesnt recognise the character. Now if I forward one the mails from the
> email client to the webmail account it then recognises and shows the
> character correctly? Very weird as it is the same mail just forwarded,
> is the problem that the mail forwarded from the email client uses a
> different content type when sent? The one specified in the PHP script is
> as follows:
>
> $mail->setHeader("Content-type", "text/plain; charset=iso-8859-1");
>
> Or is there something wrong with the charset that I'm specifying above?
The content-type header only applies to that message body part. The
character set of the headers is defined in a different way using q-encoding.
Take a look at this class that lets you define headers with whatever
encoding and character set you need to use:
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/