51Testing软件测试论坛
标题:
Bugzilla无法登录,发送邮件不成功????
[打印本页]
作者:
jhomton
时间:
2008-4-29 15:28
标题:
Bugzilla无法登录,发送邮件不成功????
大家好!
这段时间试着安装Bugzilla软件,版本为2.20.5;perl为5.8.8;apache2 2.2。
邮件发送如图
作者:
jhomton
时间:
2008-4-29 15:32
无法登录,申请新账号,发送邮件后很长时间,但没有收到任何邮件,连垃圾邮件都没有。不知道哪位知道原因
作者:
flying-kite
时间:
2008-5-12 16:31
我今天刚解决这个问题
打开...\Bugzilla\Mailer.pm, 修改如下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 ((!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 = 'smtp.163.com';
my $smtp_user = 'test@163.com';
my $smtp_pass = '123456';
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;
}
注意:我把涉及到Param方法的都注释了,因为运行时报错,无法调用。
可参考
http://blog.chinaunix.net/u1/42969/showart_342667.html
http://dev.csdn.net/article/49/49481.shtm
http://www.blogjava.net/andyhan/archive/2005/07/13/7594.html
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2