急急请问,有人用bugzilla 2.18发过中文邮件吗?不知道您是怎么实现的,可以共享一下您的经验吗?我用bugzilla发中文邮件的时候,收件方收到后显示的都是乱码。我看了一下bugzilla发送邮件的那个函数MessageToMTA,似乎是在发送的时候没有加密。借鉴网友的一些经验,并参考perl的一些资料,我把该函数改成了:sub MessageToMTA ($$){ my ($msg,$person) = (@_); my $sendmailparam = ""; unless (Param("sendmailnow")) { $sendmailparam = "-ODeliveryMode=deferred"; } if ($enableSendMail == 1) { use Net::SMTP; my $smtp_server = 'smtp.mydomain'; my $smtp_user = 'smtpuser@mailserver'; my $smtp = Net::SMTP->new($smtp_server, Hello => 'localhost', Timeout => 120, Debug => 1)|| die 'Cannot connect to server \'$smtp_server\''; my @header; push @header, 'Content-Type: text/plain; charset="gb2312"'. ""; # convert to charset to GB2312 my @new_msg; { use Encode; no strict 'refs'; push @new_msg, encode("euc-cn", $msg); } $smtp->auth('smtpuser','mypasswd'); $smtp->mail($smtp_user); $smtp->to($person); $smtp->data(); $smtp->datasend(\@header); $smtp->datasend(\@new_msg); $smtp->dataend(); $smtp->quit; }}但是接受方收到的还是乱码,查看邮件的原始信息,其中有:Received: from localhost (unknown [xxx.xxx.xxx.xxx])by pop.mailserver (Postfix) with ESMTP id 6AA6F3740AEfor <bugfixer@mailserver>; Fri, 15 Apr 2005 12:08:23 0800 (CST)Content-Type: text/plain; charset="gb2312"From:
[email protected]: bugfixer@mailserverSubject: [Bug 41] gb2312???????X-Bugzilla-Reason: AssignedToMessage-Id: <
[email protected]>Date: Fri, 15 Apr 2005 12:08:23 0800 (CST)X-Virus-Scanned: by vscan at mailserverX-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char 9C hex) in message header 'Subject' Subject: [Bug 41] gb2312?\234???\226??\201 我的分析:其中Content-Type: text/plain; charset="gb2312"一行,应该表明我上面发送邮件的header已经正确发送,主要问题,可能在:“X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char 9C hex) in message ”一句,看意思,应该是没有编码。但在上面我明明用encode编过码了呀,晕倒,请做过的大侠分析一下好吗?我的邮件倒是没有什么问题,只是名字经常是乱码~