免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2315 | 回复: 1
打印 上一主题 下一主题

邮件发送日志错误信息 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-05-11 09:03 |只看该作者 |倒序浏览
发送邮件代码如下:
      1 #!/usr/bin/perl
      2 use strict;
      3 use IO::Socket;
      4 use Net::SMTP;
      5 #use Authen::SASL;
      6 my @emails = qw( xxx@xxx.com );
      7 #my @warns = qw( aaaaaaaaaaaaa );
      8 my $mtahost = 'smtp.xxx.com';
      9 #my $mtahost = 'xx.xx.xxx.xxx';
     10 my $mtaport = xxx;
     11 #my $mtaport = 25;
     12 my $user = 'xxx';
     13 my $passwd = 'xxx';
     14 print "kkkkkkkkkkk";
     15 sub sendmail
     16 {
     17 my $msg = shift;
     18 return unless @emails;
     19 my $smtp = Net::SMTP->new('Host'=>$mtahost,'Port'=>$mtaport,Debug=>1);
     20 #$smtp->auth($user,$passwd);
     21 $smtp->auth('LOGIN',$user,$passwd);
     22 if(defined $smtp)
     23 {
     24 print ("aaaaaaaaaaaaaa";
     25 $smtp->mail("xxx\@xxx.com";
     26 #$smtp->recipient(@emails);
     27 $smtp->recipient("xxx\@xxx.com";
     28 $smtp->data();
     29 $smtp->datasend("From: Server Monitor <monitor\@sample-inc.com>\n";
     30 $smtp->datasend("To: SA Team <sa\@sample-inc.com>\n";
     31 $smtp->datasend("Subject: Server Warnings\n";
     32
     33 $smtp->datasend("\n";
     34 for (@$msg) {
     35 $smtp->datasend("$_\n";
     36 }
     37 $smtp->dataend();
     38 $smtp->quit;
     39 } else {
     40 warn("[WARN] Can't connect to SMTP host\n";
     41 }
     42 }
     43
     44 sendmail();


调试日志信息
Net::SMTP>>> Net::SMTP(2.31)
Net::SMTP>>>   Net::Cmd(2.29)
Net::SMTP>>>     Exporter(5.5
Net::SMTP>>>   IO::Socket::INET(1.29)
Net::SMTP>>>     IO::Socket(1.29)
Net::SMTP>>>       IO::Handle(1.25)
Net::SMTP=GLOB(0xafda9e0)<<< 220 smtp.xxx.com Microsoft ESMTP MAIL Service ready at Fri, 11 May 2012 08:53:35 +0800
Net::SMTP=GLOB(0xafda9e0)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0xafda9e0)<<< 250-smtp.xxx.com Hello [xx.xx.xxx.xxx]
Net::SMTP=GLOB(0xafda9e0)<<< 250-SIZE 10485760
Net::SMTP=GLOB(0xafda9e0)<<< 250-PIPELINING
Net::SMTP=GLOB(0xafda9e0)<<< 250-DSN
Net::SMTP=GLOB(0xafda9e0)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0xafda9e0)<<< 250-STARTTLS
Net::SMTP=GLOB(0xafda9e0)<<< 250-AUTH GSSAPI NTLM
Net::SMTP=GLOB(0xafda9e0)<<< 250-8BITMIME
Net::SMTP=GLOB(0xafda9e0)<<< 250-BINARYMIME
Net::SMTP=GLOB(0xafda9e0)<<< 250 CHUNKING
Net::SMTP=GLOB(0xafda9e0)>>> AUTH GSSAPI
Net::SMTP=GLOB(0xafda9e0)<<< 334 GSSAPI supported
Net::SMTP=GLOB(0xafda9e0)>>>
Net::SMTP=GLOB(0xafda9e0)<<< 334 YHYGBisGAQUFAqBsMGqgPDA6BgorBgEEAYI3AgIeBgkqhkiC9xIBAgIGCSqGSIb3EgECAgYKKoZIhvcSAQICAwYKKwYBBAGCNwICCqMqMCigJhskbm90X2RlZmluZWRfaW5fUkZDNDE3OEBwbGVhc2VfaWdub3Jl
Net::SMTP=GLOB(0xafda9e0)>>>
Net::SMTP=GLOB(0xafda9e0)<<< 535 5.7.3 Authentication unsuccessful
Net::SMTP=GLOB(0xafda9e0)>>> MAIL FROM:<xxx@xxx.com>
Net::SMTP=GLOB(0xafda9e0)<<< 530 5.7.1 Client was not authenticated
Net::SMTP=GLOB(0xafda9e0)>>> RCPT TO:<xxx@xxx.com>
Net::SMTP: Unexpected EOF on command channel at sendmail2 line 27


Authen::SASL

make

Skip blib/lib/Authen/SASL.pm (unchanged)
Skip blib/lib/Authen/SASL/EXTERNAL.pm (unchanged)
Skip blib/lib/Authen/SASL/CRAM_MD5.pm (unchanged)
Skip blib/lib/Authen/SASL/Perl/EXTERNAL.pm (unchanged)
Skip blib/lib/Authen/SASL/Perl/LOGIN.pm (unchanged)
Skip blib/lib/Authen/SASL/Perl/ANONYMOUS.pm (unchanged)
Skip blib/lib/Authen/SASL/Perl/PLAIN.pm (unchanged)
Skip blib/lib/Authen/SASL/Perl.pod (unchanged)
Skip blib/lib/Authen/SASL/Perl/DIGEST_MD5.pm (unchanged)
Skip blib/lib/Authen/SASL/Perl/CRAM_MD5.pm (unchanged)
Skip blib/lib/Authen/SASL/Perl.pm (unchanged)
Skip blib/lib/Authen/SASL.pod (unchanged)
Skip blib/lib/Authen/SASL/Perl/GSSAPI.pm (unchanged)
Manifying blib/man3/Authen::SASL:erl::LOGIN.3pm
lib/Authen/SASL/Perl/LOGIN.pm:175: Unknown command paragraph "=over4"
lib/Authen/SASL/Perl/LOGIN.pm:186: Unmatched =back
Manifying blib/man3/Authen::SASL:erl::EXTERNAL.3pm
Manifying blib/man3/Authen::SASL:erl::ANONYMOUS.3pm
Manifying blib/man3/Authen::SASL:erl:LAIN.3pm
lib/Authen/SASL/Perl/PLAIN.pm:146: Unknown command paragraph "=over4"
lib/Authen/SASL/Perl/PLAIN.pm:153: Unmatched =back
Manifying blib/man3/Authen::SASL:erl:IGEST_MD5.3pm
lib/Authen/SASL/Perl/DIGEST_MD5.pm:805: Unknown command paragraph "=over4"
lib/Authen/SASL/Perl/DIGEST_MD5.pm:815: Unmatched =back
Manifying blib/man3/Authen::SASL:erl.3pm
Manifying blib/man3/Authen::SASL:erl::CRAM_MD5.3pm
Manifying blib/man3/Authen::SASL.3pm
Manifying blib/man3/Authen::SASL:erl::GSSAPI.3pm

make test

PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t t/negotiations/*.t t/server/*.t
t/anon.......................ok                                             
t/callback...................ok                                             
t/cram_md5...................ok                                             
t/digest_md5.................ok                                             
t/digest_md5_verified........ok                                             
t/external...................ok                                             
t/login......................ok                                             
t/negotiations/digest_md5....ok                                             
t/negotiations/login.........ok                                             
t/negotiations/plain.........ok                                             
t/order......................ok                                             
t/plain......................ok                                             
t/server/digest_md5..........ok                                             
        10/33 skipped: various reasons
t/server/login..............."my" variable $cb masks earlier declaration in same scope at t/server/login.t line 75.
t/server/login...............ok                                             
t/server/plain...............ok                                             
All tests successful, 10 subtests skipped.
Files=15, Tests=313,  0 wallclock secs ( 0.29 cusr +  0.08 csys =  0.37 CPU)

make install

Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod

论坛徽章:
0
2 [报告]
发表于 2012-05-11 14:26 |只看该作者
日志和程序好像不匹配啊
用telnet服务器试试
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP