Re: SMTP and changing the character set

From: Date: Sat, 08 May 2004 12:58:34 +0000
Subject: Re: SMTP and changing the character set
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-185708@lists.php.net to get a copy of this message
Thank you both for the help. One more question: can SMPT use the Asian character set since it is 16 bits? Todd Dave G wrote:
Todd,
Is there a way to specify a character set in a SMTP email?
I've found that SMTP is really, really very particular about how you apply spacing and carriage returns when passing a content type header from PHP. In the PHP mail() function, you want to add the content type header like so: <?php $contentType = " \r\nContent-Type: text/plain; charset=UTF-8"; mail($toaddress, $subject, $mailcontent, $contentType); ?> In particular, take note of the space before \r\n. Without it, the content type header would not work. I had to do a lot of experimenting before I discovered this. You may have to some experimenting as well, as I'm not sure if all servers behave the same on this issue. Hope that helps.


« previous php.general (#185708) next »