Re: mail() encoded subject line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

on 10/16/2006 02:32 PM Emil Edeholt said the following:
> I hope this is not too off topic but I have a problem when I use mail().
> When I add the header Content-Type: text/plain; charset=UTF-8 the body
> of the mail is encoded fine but the subject is not encoded. I've tried
> to utf8_encode() and utf8_decode() the subject text but neither helps.
> 
> Any idea of how to pass what encoding to use on an email subject?

Headers encoding is independent of message body encoding set by
Content-Type. Headers need to be encoded with q-encoding algorithm.

You may want to take a look at this popular MIME message class. Just use
the SetEncodedHeader function to add the Subject or another header that
may use 8 bit (non-ASCII) data.

The character set encoding of the message is set using the
default_charset class variable. But you can use a different character
set encoding for individual headers, using the 3rd parameter of the
SetEncodedHeader function.

Take a look at the test_email_message.php example script that shows how
to send messages with non-ASCII characters in the Subject and body.

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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux