Re: Sending UTF-8 mail with mail()

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

 



On Tue, June 13, 2006 4:09 am, Peter Lauri wrote:
> How can I send UTF-8 mails with the mail() function. Right now I am
> doing:
>
> mail('theemail@xxxxxxxxxx', 'Subject', 'Message',
> "From: The Sender <sender@xxxxxxxxxx> \n" .
> "Content-Type: text/plain; charset=utf-8 \n" .
> "Content-Transfer-Encoding: 7bit\n\n")
>
> The message is being sent, but the UTF-8 specific characters are not
> being
> presented. Is there any fix on this?
>
> The messages etc are coming from a form. Is it possible to set the
> charset
> for the form?

First, you should PROBABLY use \r\n to separate headers, unless you
know you are using a badly-broken (non-compliant) MTA.

Next, you should not tack on an extra \n (now \r\n) for the last
header -- PHP is gonna do it for you.  You don't even need the
trailing \r\n for that matter, as PHP works it out...  Though it's
good in case you add more headers.

Finally, if all else fails, I'm GUESSING that you may be stuck using
HTML-enhanced (cough, cough) email to get what you want...  Which I
don't recommend, but if you must, you must, and http://phpclasses.org
has a class you can use to build it.  Rolling your own is a real
PITA...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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