51Testing软件测试论坛

标题: 急!!bugzilla使用postfix邮件配置问题 [打印本页]

作者: 在此间    时间: 2010-7-12 17:33
标题: 急!!bugzilla使用postfix邮件配置问题
公司的邮件服务器改成postfix的了,bugzilla无法发送邮件,有没有高手知道该如何修改配置啊!!
公司的bugzilla版本是2.18.5,以下是公司现在bugzilla的邮件配置:
sub MessageToMTA ($;$) {
   my ($msg, $rcpt_to) = (@_);

    my $sendmailparam = "";
    unless (Param("sendmailnow")) {
       $sendmailparam = "-ODeliveryMode=deferred";
    }

    if ($enableSendMail == 1) {
#        open(SENDMAIL, "|/usr/lib/sendmail $sendmailparam -t -i") ||
#          die "Can't open sendmail";
#
#        print SENDMAIL trim($msg) . "\n";
#        close SENDMAIL;

#add for send mail
        use Net::SMTP;
        my $smtp_server = '192.168.10.2';
        my ($msg, $person) = (@_);
# Use die on error, so that the mail will be in the 'unsent mails' and
# can be sent from the sanity check page.
        my $smtp = Net::SMTP->new($smtp_server) ||
        die 'Cannot connect to server \'$smtp_server\'';

# auth sender, XXXbugs is the mailbox used as bugzilla daemon.
        $smtp->auth('yuandan', 'yuandan') or die "auth error\n";
        $smtp->mail('yuandan@XXX.com');#from person
        $smtp->to($person); #...........person.........
        $smtp->data();
        $smtp->datasend($msg); #...........msg.........
        $smtp->dataend();
        $smtp->quit;
    }
}
作者: swaiwai    时间: 2010-7-13 17:39
UP学习
作者: 在此间    时间: 2010-7-14 16:41
哈哈,问题解决了!还是开发人员帮忙解决的,代码改后如下:
sub MessageToMTA ($;$) {
   my ($msg, $rcpt_to) = (@_);

    my $sendmailparam = "";
    unless (Param("sendmailnow")) {
       $sendmailparam = "-ODeliveryMode=deferred";
    }

    if ($enableSendMail == 1) {
#        open(SENDMAIL, "|/usr/lib/sendmail $sendmailparam -t -i") ||
#          die "Can't open sendmail";
#
#        print SENDMAIL trim($msg) . "\n";
#        close SENDMAIL;

#add for send mail
        use Net::SMTP;
        my $smtp_server = '192.168.10.2';
        my $smtp_user = 'yuandan@XXX.com';
             my $smtp_pass = 'yuandan';

            #my $encode_smtpuser = trim(encode_base64($smtp_user));
             #my $encode_smtppass = trim(encode_base64($smtp_pass));
        my ($msg, $person) = (@_);
# Use die on error, so that the mail will be in the 'unsent mails' and
# can be sent from the sanity check page.
        my $smtp = Net::SMTP->new($smtp_server) ||
        die 'Cannot connect to server \'$smtp_server\'';

# auth sender, XXXbugs is the mailbox used as bugzilla daemon.
       
        #$smtp->auth('yuandan', 'yuandan') or die "auth error\n";
        
        my $result = $smtp->command('AUTH','LOGIN');
        my $answer = $smtp->getline();
             # 334 VXNlcm5hbWU6

             $result = $smtp->command($smtp_user);
             $answer = $smtp->getline();
             # 334 UGFzc3dvcmQ6
  
             $result = $smtp->command($smtp_pass);
             $answer = $smtp->getline();
             # 235 Authentication successful
             # or 535 Authentication failed
             if ($answer =~ /535/i)
             {print "Sorry,Authentication failed!n";exit;}

        $smtp->mail('yuandan@XXX.com');#from person
        $smtp->to($person); #...........person.........
        $smtp->data();
        $smtp->datasend($msg); #...........msg.........
        $smtp->dataend();
        $smtp->quit;
    }
}




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2