Re: PHP mail() problem
| From: | Errotan ) | Date: | Tue, 20 Mar 2007 14:04:10 +0000 |
| Subject: | Re: PHP mail() problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250914@lists.php.net to get a copy of this message | ||
Hi.
Recently I have this kind of issue.
This is a possible solution:
$text="message text";
$subject="message subject";
$header="From: somebody@example.com\r\n".
"MIME-Version: 1.0\r\n".
"Content-type: text/html; charset=utf-8\r\n".
"Content-Transfer-Encoding: 8bit\r\n";
$subject2=utf8_encode($subject);
$text2=utf8_encode($text);
mail("somebody@example.com",$subject,$text2,$header);
This encodes message to UTF-8 and should work.
2007. március 20. 10.54 dátummal Delta Storm ezt írta:
> Hi,
>
> I'm having problem with character encoding in PHP mail functions.
>
> CODE:
> $headers.= "Content-Type: text/html; charset=iso-8859-1";
> $headers .= "MIME-Version: 1.0 ";
> $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
> $headers .="Content-Type: multipart/alternative;
> boundary=0-92766976-1174383938=:29106";
> $to = "unix_master10@yahoo.com";
> $subject = $_POST['cat'];
> $body = $_POST['text'];
> if (mail($to, $subject, $body, $headers))
> {
> echo('<p>Message successfully sent!</p><br /><a
> href="showarticle.php?cid=5&id=3">Povratak</a>');
> }
> else
> {
> echo('<p>Message delivery failed...</p><br /><a
> href="showarticle.php?cid=5&id=3">Povratak</a>');
> }
>
> Im receiving mail as you see using yahoo.com. It all works except it
> doesn't show croatian letters... I also tried with encoding utf-8, same
> thing...
> ČĆŽŠĐ
>
> Please help, thank you very much!