I have a dedicated server that connects to a webhosting to send a mails using SMTP protocol, but I get 554 5.7.1 and 221 2.7.0 errors and e-mail won't send. Full SMTP log is below.
This is a script for sending e-mails written in 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;
And I get 554 5.7.1 and 221 2.7.0 errors. This is a log from 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.
I really don't know, where can be a problem, I was looking for solution but I didn't find anything.
Breakdown of the errors for completeness -
When sending the list of recipients, the server is responding with an error which clearly indicates the problem. Interesting that they chose to respond with an error at this point, whilst accepting the sender address without issue, but that's up to them. You will need to ask the mail provider if you want to know why they think the account was compromised.
Server returns an error here because you're attempting to send the content of the message, but haven't yet set any recipients - The two given were both rejected. A correct mail client would error out / disconnect when no recipients were accepted and would not send the
DATA
command.A snarky response from the server when your client continues to attempt to send data to the server, even though there are no valid recipients and it has rejected your
DATA
command.