ひいろ
unread,Jun 8, 2011, 7:00:52 AM6/8/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Elgg 日本ユーザーグループ
私はどうせISO-2022-JPしか使用しないので、以下のように修正してしまいました。
/**** 追加 ****/ とか /**** 削除 **** とか書いてある箇所が、変更部分です。
elgg-1.7.4なので多少異なるかも知れません。
ご参考までに。
//////////////////////
function elgg_send_email($from, $to, $subject, $body, array $params =
NULL) {
global $CONFIG;
/**** 追加 ****/
mb_language('ja');
/**************/
if (!$from) {
throw new
NotificationException(sprintf(elgg_echo('NotificationException:NoEmailAddress'),
'from'));
}
if (!$to) {
throw new
NotificationException(sprintf(elgg_echo('NotificationException:NoEmailAddress'),
'to'));
}
// return TRUE/FALSE to stop elgg_send_email() from sending
$mail_params = array( 'to' => $to,
'from' =>
$from,
'subject' =>
$subject,
'body' =>
$body,
'params' =>
$params);
$result = trigger_plugin_hook('email', 'system', $mail_params,
NULL);
if ($result !== NULL) {
return $result;
}
$header_eol = "\r\n";
if (isset($CONFIG->broken_mta) && $CONFIG->broken_mta) {
// Allow non-RFC 2822 mail headers to support some
broken MTAs
$header_eol = "\n";
}
// Windows is somewhat broken, so we use just address for to
and from
if (strtolower(substr(PHP_OS, 0 , 3)) == 'win') {
// strip name from to and from
if (strpos($to, '<')) {
preg_match('/<(.*)>/', $to, $matches);
$to = $matches[1];
}
if (strpos($from, '<')) {
preg_match('/<(.*)>/', $from, $matches);
$from = $matches[1];
}
}
/**** 削除 ****
$headers = "From: $from{$header_eol}"
. "Content-Type: text/plain; charset=UTF-8;
format=flowed{$header_eol}"
. "MIME-Version: 1.0{$header_eol}"
. "Content-Transfer-Encoding: 8bit{$header_eol}";
**************/
/**** 追加 ****/
$headers = "From: $from{$header_eol}"
. "Content-Type: text/plain; charset=ISO-2022-JP";
/**************/
// Sanitise subject by stripping line endings
$subject = preg_replace("/(\r\n|\r|\n)/", " ", $subject);
/**** 削除 ****
if (is_callable('mb_encode_mimeheader')) {
$subject = mb_encode_mimeheader($subject,"UTF-8",
"B");
}
**************/
// Format message
$body = html_entity_decode($body, ENT_COMPAT, 'UTF-8'); //
Decode any html entities
$body = strip_tags($body); // Strip tags from message
$body = preg_replace("/(\r\n|\r)/", "\n", $body); // Convert
to unix line endings in body
$body = preg_replace("/^From/", ">From", $body); // Change
lines starting with From to >From
/**** 削除 ****
return mail($to, $subject, wordwrap($body), $headers);
**************/
/**** 追加 ****/
return mb_send_mail($to, $subject, $body, $headers);
/**************/
}