4

I am using Postfix to communicate with foreign server and send a mail. Every time when I try send mail using Postfix, I get this error:

(host mx2.seznam.cz[77.75.76.32] said: 451 Local Error (in reply to end of DATA command))

After a while of debugging, I got SMTP transcription:

220 2.0.0 Seznam SMTP server waiting for your HELO/EHLO
EHLO alpha.tbedrich.cz
250-Email.Seznam.cz - Email zdarma na cely zivot ESMTP
250-8BITMIME
250-SIZE 18000000
250-ENHANCEDSTATUSCODES
250 X-SZNEXTENSIONS
MAIL FROM:<ja@tbedrich.cz> SIZE=1007
250 2.1.0 Ok <ja@tbedrich.cz>
RCPT TO:<tb@seznam.cz>
250 2.1.5 Ok <tb@seznam.cz>
DATA
354 Start mail input; end with <CRLF>.<CRLF>
Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com [209.85.217.176])
    by alpha.tbedrich.cz (Postfix) with ESMTPSA id 8520F401DB
    for <tb@seznam.cz>; Thu, 27 Aug 2015 19:09:37 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tbedrich.cz; s=mail;
    t=1440695377; bh=CG6CavtqSpj8fj6WkmsWGRsGNN0Qa3sWp3MV/1BiTCY=;
    h=From:Date:Subject:To:From;
    b=GtnSxBgTLQsBIjn0DTUAm7zgfiIUOJjunmWHeCLSEit+QqyaGy63QzLd4yvzJYNNW
     6Fpc2LySSMB3QfxvhNOaxZZaP1aBUVaqH8nGulPgKeC5B67HgKGIpIP8o8F8oEDZyc
     G7TPnXC6zA62Nr5FzSlmMYpWwQh4HR2RYEJDvFrU=
Received: by lbbtg9 with SMTP id tg9so15579426lbb.1
        for <tb@seznam.cz>; Thu, 27 Aug 2015 10:09:36 -0700 (PDT)a
X-Received: by 10.152.21.231 with SMTP id y7mr2710607lae.63.1440695376852;
 Thu, 27 Aug 2015 10:09:36 -0700 (PDT)
MIME-Version: 1.0
From: =?UTF-8?B?VG9tw6HFoSBCZWTFmWljaA==?= <ja@tbedrich.cz>
Date: Thu, 27 Aug 2015 17:09:27 +0000
Message-ID: <CALS8Sqg8HQVmHt2UOiLfRMmkHyzzD2G2nKGPhqnh=3hjKW=NOA@mail.gmail.com>
Subject: test
To: tb@seznam.cz
Content-Type: multipart/alternative; boundary=089e0158aea02abfcc051e4e0861

--089e0158aea02abfcc051e4e0861
Content-Type: text/plain; charset=UTF-8



--089e0158aea02abfcc051e4e0861
Content-Type: text/html; charset=UTF-8

<div dir="ltr"><br></div>

--089e0158aea02abfcc051e4e0861--
.
451 Local Error
502 5.5.1 Command ' by ' not implemented.
502 5.5.1 Command ' for' not implemented.
502 5.5.1 Command 'DKIM' not implemented.
502 5.5.1 Command ' t=1' not implemented.
502 5.5.1 Command ' h=F' not implemented.
502 5.5.1 Command ' b=G' not implemented.
502 5.5.1 Command '  6F' not implemented.
502 5.5.1 Command '  G7' not implemented.
502 5.5.1 Command 'Rece' not implemented.
502 5.5.1 Command '    ' not implemented.
502 5.5.1 Command 'X-Re' not implemented.
502 5.5.1 Command ' Thu' not implemented.
502 5.5.1 Command 'MIME' not implemented.
502 5.5.1 Command 'From' not implemented.
502 5.5.1 Command 'Date' not implemented.
502 5.5.1 Command 'Mess' not implemented.
502 5.5.1 Command 'Subj' not implemented.
502 5.5.1 Command 'To: ' not implemented.
502 5.5.1 Command 'Cont' not implemented.
501 Command too short.
502 5.5.1 Command '--08' not implemented.
502 5.5.1 Command 'Cont' not implemented.
501 Command too short.
501 Command too short.
501 Command too short.
502 5.5.1 Command '--08' not implemented.
502 5.5.1 Command 'Cont' not implemented.
501 Command too short.
502 5.5.1 Command '<div' not implemented.
501 Command too short.
502 5.5.1 Command '--08' not implemented.
501 Command too short.
QUIT

Why the foreign server doesn't understand the communication? I don't see anything bad in it.

  • 1
    @masegaloeh scroll down in SMTP transcript – tomasbedrich Aug 28 '15 at 10:36
  • 1
    This error happened to me when connecting to seznam.cz and centrum.cz. Google mail servers works. It may look suspicious, but Seznam is a big company in the Czech Republic, not some stranger with one server. – tomasbedrich Aug 28 '15 at 10:43
  • 2
    I don't think it's Postfix where the change should be made, but rather an original application (the one generating message). Try saving the message in a UNIX (LF-only) file, then run cat file |sendmail -i -t, next convert the file to DOS format (CR+LF) with todos file, then again cat file |sendmail -i -t. Check mail logs. This test should tell you whether the problem lies here. It the test confirms, I'll convert the comment to a proper answer. – sam_pan_mariusz Aug 28 '15 at 11:45
  • 3
    Perhaps their mailserver was misconfigured and then they fixed it :) – masegaloeh Aug 28 '15 at 15:04
  • 1
    This is not a problem with your system, but with your recipient's system. – Michael Hampton Aug 28 '15 at 15:55
4

The recipient's mailserver gives you the clue:

451 Local Error

This means that their server is having a problem and you should try back later.

From your log, it appears likely that their mailserver flaked out after receiving the first line of the email content, and that every line in the email after that was interpreted as a new command - which failed, since they're not valid SMTP commands.

I'm guessing that you did a copy-paste of the email contents; if you'd pasted one line at a time instead of the entire email, you would have gotten the error message immediately after that first line, and you would not have gotten the rest of the error messages, which would have made the problem a lot clearer.

Since it's their mailserver that is having the issue, not yours, there's nothing you can do to fix it. You'll have to wait, or possibly phone them.

3

It seems to be a CR+LF problem. Are you sure you send both control characters for end of lines in DATA? Not every MTA is sensitive to this, AFAIK.

I don't think it's Postfix where the change should be made, but rather an original application (the one generating message). Try saving the message in a UNIX (LF-only) file, then run cat file |sendmail -i -t, next convert the file to DOS format (CR+LF) with todos file, then again cat file |sendmail -i -t. Check mail logs. This test should tell you whether the problem lies here.

  • What makes you think this is a CRLF problem? I see nothing at all in the log to indicate it. – Jenny D Sep 1 '15 at 14:40
  • Look at the error lines after end of DATA. Looks like DATA lines are separated incorrectly, the first error being the second line of DATA (multi-line header here). And the separator here is line break. So if (hypothetical) incomplete rows separator is used, the parser goes nuts. I can even imagine a simple parsing algorithm that could behave this way on LF-only endings... And we don't know the remote MTA software. – sam_pan_mariusz Sep 1 '15 at 15:27
  • I grant that it is possible. It is also possible that the mailserver is trying to invoke some filtering software that isn't responding at all, for whatever reason. But if the CRLFs were broken, that would affect not only the first line but all subsequent lines, right? But the mailserver is clearly able to handle those separators - only it's treating them as syntactically incorrect commands instead of as part of the body of an email. This is because the entire email was pasted into the session in one go, instead of line by line, so the first error message doesn't show until after the mail. – Jenny D Sep 1 '15 at 15:46
  • 1
    You're right, your answer fits better here. And the problem is long gone, so our discussion is purely theoretical. I've never claimed the CR+LF issue as evident. But there were reasons to suspect it, especially given all from my first comment (4 h. ago), and that this problem can be triggered easily from an application and go unnoticed for some time. Can't processing error really be triggered by invalid input? The server expects CR+LFs here (as indicated), but I unfortunately don't know how tolerant in this matter are this and other modern MTAs (my own experience show the're highly). – sam_pan_mariusz Sep 1 '15 at 19:38
  • 2
    Thanks @tomasbedrich! Still, if the problem had been with the contents of the email, it should not have caused a 4xx error. 4xx means "it's not working now, but you can try again later without changing anything". If the issue had been with the contents of the email, it should have given a 5xx error. – Jenny D Sep 2 '15 at 4:12
1

Expand statement from comment section

SMTP transaction is involving two parties here, sender and receiver. Both servers must have some agreement when they talk each other. When one server complain about protocol disagreement like above, them either your server or their was misconfigured.

To debug it, try to send email to another server. If you're the problem, then you will fail to talk to the others. Also try to send email to your receiver via another mail server. If another server has same problem too, then perhaps the receiver was misconfigured.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.