51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2835|回复: 2
打印 上一主题 下一主题

[原创] 急!!bugzilla使用postfix邮件配置问题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2010-7-12 17:33:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
公司的邮件服务器改成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;
    }
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2010-7-13 17:39:49 | 只看该作者
UP学习
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2010-7-14 16:41:36 | 只看该作者
哈哈,问题解决了!还是开发人员帮忙解决的,代码改后如下:
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;
    }
}
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-9-20 22:55 , Processed in 0.066148 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表