【问题标题】:Hit sasl_decode error while sending mail through sendmail server通过 sendmail 服务器发送邮件时遇到 sasl_decode 错误
【发布时间】:2014-04-12 09:17:34
【问题描述】:

在 RHEL 工作站 6.3 上安装了 sendmail 和 openwebmail,我可以通过 webmail(cgi-bin/openwebmail/openwebmail.pl) 发送电子邮件,但无法在 Perl 脚本中与 sendmail 服务器交互,如下所示:

use Net::SMTP;

my $smtpserver = 'mail.server.com';
my $smtpport = 25;
my $smtpuser   = 'test';
my $smtppassword = 'test';
my $smtp = Net::SMTP->new($smtpserver, Port=>$smtpport, Timeout => 10, Debug => 1);
die "Could not connect to server!\n" unless $smtp;
$smtp->auth($smtpuser, $smtppassword);
$smtp->mail("Ann");
$smtp->to("hello\@world.com");
$smtp->data();
$smtp->datasend("To: hello\@world.com\n");
$smtp->quit;

在 Windows 7 上运行此 Perl 脚本时,输出如下:

Net::SMTP>>> Net::SMTP(2.31)
Net::SMTP>>>   Net::Cmd(2.29)
Net::SMTP>>>     Exporter(5.64_01)
Net::SMTP>>>   IO::Socket::INET(1.31)
Net::SMTP>>>     IO::Socket(1.31)
Net::SMTP>>>       IO::Handle(1.28)
Net::SMTP=GLOB(0x2be1e80)<<< 220 mail.server.com ESMTP Sendmail 8.14.4/8.14.4
; Fri, 11 Apr 2014 19:48:30 +0800
Net::SMTP=GLOB(0x2be1e80)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x2be1e80)<<< 250-mail.server.com Hello [9.110.10.236], please
d to meet you
Net::SMTP=GLOB(0x2be1e80)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0x2be1e80)<<< 250-PIPELINING
Net::SMTP=GLOB(0x2be1e80)<<< 250-8BITMIME
Net::SMTP=GLOB(0x2be1e80)<<< 250-SIZE
Net::SMTP=GLOB(0x2be1e80)<<< 250-DSN
Net::SMTP=GLOB(0x2be1e80)<<< 250-ETRN
Net::SMTP=GLOB(0x2be1e80)<<< 250-AUTH DIGEST-MD5 PLAIN
Net::SMTP=GLOB(0x2be1e80)<<< 250-DELIVERBY
Net::SMTP=GLOB(0x2be1e80)<<< 250 HELP
Net::SMTP=GLOB(0x2be1e80)>>> AUTH DIGEST-MD5
Net::SMTP=GLOB(0x2be1e80)<<< 334 bm9u...
3VnV5VXB6MlBJeHY5TVE9IixyZWFsbT0iaHV...
Net::SMTP=GLOB(0x2be1e80)>>> YXV0a...
Net::SMTP=GLOB(0x2be1e80)<<< 334 cnNwYXV0axODVhOA==
Net::SMTP=GLOB(0x2be1e80)>>>
Net::SMTP=GLOB(0x2be1e80)<<< 235 2.0.0 OK Authenticated
Net::SMTP=GLOB(0x2be1e80)>>> MAIL FROM:<hello>
Net::SMTP: Unexpected EOF on command channel at E:\tool\smtp.pl line 35

显示客户端通过了“$smtp->mail()”的验证,但没有收到任何数据,似乎服务器此时关闭了连接。

在服务器端,有一些错误信息写入/var/log/maillog:

Apr 11 19:48:30 bill sendmail[16761]: AUTH=server, relay=[9.110.10.6], authid=test, mech=DIGEST-MD5, bits=128
Apr 11 19:48:30 bill sendmail[16761]: AUTH: sasl_decode error=-1
Apr 11 19:48:30 bill sendmail[16761]: s3BBmUQj016761: [9.110.10.236] did not issue MAIL/EXPN/VRFY/ETRN    during connection to MTA

maillog 显示验证方法为 DIGEST-MD5,但调用 sasl_decode 失败。

任何人都可以为这个问题提供任何线索吗?非常感谢。

PS:我的 sendmail.mc 粘贴在github

【问题讨论】:

    标签: linux perl smtp sendmail


    【解决方案1】:

    在这里,我猜测旧版本存在错误。请检查此 CPAN RT

    https://rt.cpan.org/Public/Bug/Display.html?id=58002

    【讨论】:

    • 乔,你是对的。我使用 Java 重写了一个测试用例,它收到了电子邮件。非常感谢。
    猜你喜欢
    • 2013-09-06
    • 2010-09-09
    • 2019-05-11
    • 2014-09-03
    • 1970-01-01
    • 2013-10-31
    • 2012-11-19
    • 2011-11-20
    • 2011-01-22
    相关资源
    最近更新 更多