|
安装bugzilla的环境为:
windwos 2003+mysql 4.0.17+IIS+bugzilla 2.22.2
安装完成后,按网上提供的使用第三方smtp发送邮件,
完成后,可以在提交bug和bug跟踪时收到邮件。
但是在首面上注册新用户却是怎么也收不到邮件。
不知道那位大大碰到过此类问题,有没有什么解决办法。
要以发到我的邮箱:kingrobot@foxmail.com
谢谢!!
代码如下:(主要是修改MessageToMTA的内容)
sub MessageToMTA {
my ($msg) = (@_);
return if (Param('mail_delivery_method') eq "none");
my ($header, $body) = $msg =~ /(.*?n)n(.*)/s ? ($1, $2) : ('', $msg);
my $headers;
if (Param('utf8') and (!is_7bit_clean($header) or !is_7bit_clean($body))) {
($headers, $body) = encode_message($msg);
} else {
my @header_lines = split(/n/, $header);
$headers = new Mail::Header @header_lines, Modify => 0;
}
# Use trim to remove any whitespace (incl. newlines)
my $rcpt_to = trim($headers->get('to'));
use Net::SMTP;
my $smtp_server = 'mx.hit.edu.cn';
my $smtp_user = 'hdpan@hit.edu.cn';
my $smtp_pass = 'xxxxxx';
my $encode_smtpuser = trim(encode_base64($smtp_user));
my $encode_smtppass = trim(encode_base64($smtp_pass));
my $smtp = Net::SMTP->new($smtp_server,Timeout => 60) ||
die 'Cannot connect to smtp server';
my $result = $smtp->command('AUTH','LOGIN');
my $answer = $smtp->getline();
# 334 VXNlcm5hbWU6
$result = $smtp->command($encode_smtpuser);
$answer = $smtp->getline();
# 334 UGFzc3dvcmQ6
$result = $smtp->command($encode_smtppass);
$answer = $smtp->getline();
# 235 Authentication successful
# or 535 Authentication failed
if ($answer =~ /535/i)
{print "Sorry,Authentication failed!n";exit;}
$smtp->mail($smtp_user);
$smtp->to($rcpt_to);
$smtp->data();
$smtp->datasend($msg);
$smtp->dataend();
$smtp->quit;
} |
|