rsvp模块发送邮件乱码怎么调整

没有找到在什么位置进行转码工作,当前我负责的网站就rsvp发送的邮件是乱码

我今天搞定了

昨天浏览代码没发现地方,马虎了:
修改为:

function _rsvp_mail($invite) {
  global $user;
  $site = variable_get("site_name", "drupal");
  $webmaster = variable_get("site_mail", "");
  if($webmaster) {
    $webmaster = "-f".$webmaster;
  }
  $from = $user->name .' <'. $user->mail .'>';
  $subject = $site ." - ". t('Event Invitation');
  $to = $invite->email;
  $body = t("Hello!\n\nYou have been invited to attend an event by %owner at %site.\n\nYou can view the event itself by following this link: \n%eventurl\n\nYou can view the full invitation by following this link: \n%url\n\nHere is the invitation message:\n", array('%owner'=>$user->name, '%site'=>$site, '%eventurl'=>url("node/$invite->nid", NULL, NULL, 1), '%url'=>url("rsvp/email/$invite->hash", NULL, NULL, 1))) .$invite->invite_text;
  $to = iconv('UTF-8','GB2312',$to);
  $body = iconv('UTF-8','GB2312',$body);
  $from = iconv('UTF-8','GB2312',$from);
  $subject = iconv('UTF-8','GB2312',$subject);
  return mail($to, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal (rsvp.module)\nReturn-path: <$from>\nErrors-to: $from\n",$webmaster);
}

修改二:
function _rsvp_message_rsvp($edit) {
  global $user;
  $site = variable_get("site_name", "drupal");
  $webmaster = variable_get("site_mail", "");
  if($webmaster) {
    $webmaster = "-f".$webmaster;
  }
  $from = $user->name .' <'. $user->mail .'>';
  $subject = $site ." - ". $edit['subject'];

  $status['success'] = array();
  $status['failed'] = array();

  $attendees = _rsvp_get_attendees($edit['rid']);
  while($attendee = db_fetch_object($attendees)) {
    $invite = _rsvp_get_invite($attendee->hash);

    $body = t("Hello!\n\nYou have been sent a message by %sender at %site.\n\nYou can view the invitation from where it originated by following this link: \n%url\n\nHere is the message:\n", array('%sender'=>$user->name, '%site'=>$site, '%url'=>url("rsvp/email/$invite->hash", NULL, NULL, 1))) . $edit['body'];

    $to = "$attendee->email <". $attendee->email .'>';
  $to = iconv('UTF-8','GB2312',$to);
  $body = iconv('UTF-8','GB2312',$body);
  $from = iconv('UTF-8','GB2312',$from);
  $subject = iconv('UTF-8','GB2312',$subject);
    if(mail($to, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal (rsvp.module)\nReturn-path: <$from>\nErrors-to: $from\n",$webmaster)) {
      $status['success'][$invite->email] = substr($invite->email, 0, strpos($invite->email, '@'));
    }
    else {
      $status['failed'][$invite->email] = substr($invite->email, 0, strpos($invite->email, '@'));
    }
  }

  return $status;
}

我觉得这样修改不是

我觉得这样修改不是很对,要完美的话,应该修改邮件,告诉邮件使用utf-8编码,body加"mime-version: 1.0\r\n
content-transfer-encoding: utf-8",没试过,这样做不知道对不对。 可以在网上找邮件编码的问题看看。
这个问题还是很深的,要花点时间研究才行,可能算是rsvp的一个bug?
楼上的方法也不失为一种权宜之策。

你的担心多余了

刚才我进一步测试,邮件完全是gb2312的,邮件的所有部分没出现异常。 你可以进一步去调试。 放心使用以上代码。
在user_module里面,必须要修改你说这的这一行。

北京阳光志愿者俱乐部
http://www.ygclub.org

有一个utf-8的patch

本来想自己试做看看的,不过网上已有了解决方法。
详情请见http://drupal.org/node/46655
它这个patch,应该可以解决邮件乱码问题,而且邮件并不一定要完全是gb2312的。

不错

这个patch是utf-8格式,我转gb2312在于方便中国人收邮件,许多非专业人员不知道怎么用utf-8察看邮件

北京阳光志愿者俱乐部
http://www.ygclub.org

许多非专业人员不知

许多非专业人员不知道怎么用utf-8察看邮件,这确实是个重要的现实,,

如果改成GB2312的话,是否网站整个都得GB2312了??????????

§
§
§
§
§
==============
【我的博客tao.kaoart.info

§
§
§
§
§
-----------------------------
【我的博客我的博客
【我的网站我的网站

不用吧,只要订阅的

不用吧,只要订阅的邮件是GB就好了。

哦,试试去 § § § §

哦,试试去
§
§
§
§
§
==============
【我的博客tao.kaoart.info

§
§
§
§
§
-----------------------------
【我的博客我的博客
【我的网站我的网站