note 100617 deleted from function.mb-send-mail by danbrown
| From: | danbrown@php.net | Date: | Wed, 27 Oct 2010 13:44:51 +0000 |
| Subject: | note 100617 deleted from function.mb-send-mail by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173501@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
<?php
function sendMail($to, $subject, $body, $from_email,$from_name)
{
$headers = "MIME-Version: 1.0 \n" ;
$headers .= "From: " .
"".mb_encode_mimeheader
(mb_convert_encoding($from_name,"ISO-2022-JP","AUTO"),"ISO-2022-JP")
."" .
"<".$from_email."> \n";
$headers .= "Reply-To: " .
"".mb_encode_mimeheader
(mb_convert_encoding($from_name,"ISO-2022-JP","AUTO"),"ISO-2022-JP")
."" .
"<".$from_email."> \n";
$headers .= "Content-Type: text/plain;charset=ISO-2022-JP \n";
/* Convert body to same encoding as stated
in Content-Type header above */
$body = mb_convert_encoding($body, "ISO-2022-JP","AUTO");
/* Mail, optional paramiters. */
$sendmail_params = "-f$from_email";
mb_language("ja");
$subject = mb_convert_encoding($subject, "ISO-2022-JP","AUTO");
$subject = mb_encode_mimeheader($subject);
$result = mail($to, $subject, $body, $headers, $sendmail_params);
return $result;
}
?>