RE: [PHP] SMTP and changing the character set
| From: | Dave G | Date: | Sat, 08 May 2004 10:48:55 +0000 |
| Subject: | RE: [PHP] SMTP and changing the character set | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185705@lists.php.net to get a copy of this message | ||
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.
--
Yoroshiku!
Dave G
ml@autotelic.com