我有一个连接到虚拟主机以使用 SMTP 协议发送邮件的专用服务器,但我收到 554 5.7.1 和 221 2.7.0 错误并且电子邮件不会发送。完整的 SMTP 日志如下。
这是一个用 Perl 编写的用于发送电子邮件的脚本:
my $mail = "mail.bellakabelky.sk";
my $pass = "secret";
my $user = "mail\@bellakabelky.sk";
my $to = "tomsk.slovak\@gmail.com";
use Data::Dumper;
use Net::SMTP;
use Mail::Mailer qw(sendmail);
my $smtp = Net::SMTP->new(
Host => $mail,
Port => '25',
Hello => 'dev.bellakabelky.sk',
Timeout => 30,
Debug => 1,
);
print Dumper($smtp);
$smtp->auth($user,$pass);
$smtp->mail($user);
$smtp->to($to);
$smtp->recipient($to);
$smtp->data();
$smtp->datasend("To: Tomsk <$to>\r\n");
$smtp->datasend("From: Mail <$user>\r\n");
$smtp->datasend("Return-Path: $user\r\n");
$smtp->datasend("Reply-To: $user\r\n");
$smtp->datasend("Subject: Subject\r\n");
$smtp->datasend("\r\n");
$smtp->datasend("hello");
$smtp->dataend();
$smtp->quit;
我得到 554 5.7.1 和 221 2.7.0 错误。这是来自 SMTP 的日志:
Net::SMTP>>> Net::SMTP(2.33)
Net::SMTP>>> Net::Cmd(2.30)
Net::SMTP>>> Exporter(5.71)
Net::SMTP>>> IO::Socket::INET(1.35)
Net::SMTP>>> IO::Socket(1.38)
Net::SMTP>>> IO::Handle(1.35)
Net::SMTP=GLOB(0x51d1810)<<< 220 mail4-1.hostmaster.sk ESMTP Postfix
Net::SMTP=GLOB(0x51d1810)>>> EHLO dev.bellakabelky.sk
Net::SMTP=GLOB(0x51d1810)<<< 250-mail4-1.hostmaster.sk
Net::SMTP=GLOB(0x51d1810)<<< 250-PIPELINING
Net::SMTP=GLOB(0x51d1810)<<< 250-SIZE 104857600
Net::SMTP=GLOB(0x51d1810)<<< 250-ETRN
Net::SMTP=GLOB(0x51d1810)<<< 250-STARTTLS
Net::SMTP=GLOB(0x51d1810)<<< 250-AUTH PLAIN LOGIN
Net::SMTP=GLOB(0x51d1810)<<< 250-AUTH=PLAIN LOGIN
Net::SMTP=GLOB(0x51d1810)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0x51d1810)<<< 250 8BITMIME
$VAR1 = bless( \*Symbol::GEN1, 'Net::SMTP' );
Net::SMTP=GLOB(0x51d1810)>>> AUTH PLAIN bWFpbEBiZWxsYWthYmVsa3kuc2sAbWFpbEBiZWxsYWthYmVsa3kuc2sARXNob3AxMjNrYWJlbGt5
Net::SMTP=GLOB(0x51d1810)<<< 235 2.7.0 Authentication successful
Net::SMTP=GLOB(0x51d1810)>>> MAIL FROM:<[email protected]>
Net::SMTP=GLOB(0x51d1810)<<< 250 2.1.0 Ok
Net::SMTP=GLOB(0x51d1810)>>> RCPT TO:<[email protected]>
Net::SMTP=GLOB(0x51d1810)<<< 554 5.7.1 <[email protected]>: Sender address rejected: Your mail account ([email protected]) was compromised. Please change your password immediately after next login and contact technical support.
Net::SMTP=GLOB(0x51d1810)>>> RCPT TO:<[email protected]>
Net::SMTP=GLOB(0x51d1810)<<< 554 5.7.1 <[email protected]>: Sender address rejected: Your mail account ([email protected]) was compromised. Please change your password immediately after next login and contact technical support.
Net::SMTP=GLOB(0x51d1810)>>> DATA
Net::SMTP=GLOB(0x51d1810)<<< 554 5.5.1 Error: no valid recipients
Net::SMTP=GLOB(0x51d1810)>>> To: Tomsk <[email protected]>
Net::SMTP=GLOB(0x51d1810)>>> From: Mail <[email protected]>
Net::SMTP=GLOB(0x51d1810)>>> Return-Path: [email protected]
Net::SMTP=GLOB(0x51d1810)>>> Reply-To: [email protected]
Net::SMTP=GLOB(0x51d1810)>>> Subject: Subject
Net::SMTP=GLOB(0x51d1810)>>>
Net::SMTP=GLOB(0x51d1810)>>> hello
Net::SMTP=GLOB(0x51d1810)>>> .
Net::SMTP=GLOB(0x51d1810)<<< 221 2.7.0 Error: I can break rules, too. Goodbye.
Net::SMTP=GLOB(0x51d1810)>>> QUIT
Net::SMTP: Unexpected EOF on command channel at (eval 187) line 49.
我真的不知道,哪里可能有问题,我一直在寻找解决方案,但我没有找到任何东西。
完整性错误的细分 -
发送收件人列表时,服务器响应错误,清楚地表明问题。有趣的是,他们此时选择以错误响应,同时毫无问题地接受发件人地址,但这取决于他们。如果您想知道他们认为帐户被盗用的原因,您需要询问邮件提供商。
服务器在此处返回错误,因为您正在尝试发送消息的内容,但尚未设置任何收件人 - 给定的两个都被拒绝。当没有收件人被接受并且不会发送
DATA
命令时,正确的邮件客户端会出错/断开连接。当您的客户端继续尝试向服务器发送数据时,服务器会发出尖刻的响应,即使没有有效的收件人并且它已经拒绝了您的
DATA
命令。