Okay, so, let's look at the RFC-822 email standard.  The steps are simply
as follows:

   1. connect to server
   2. send initiation command. (HELO or EHLO)
   3. Send MAIL TO command (MAIL TO: recipi...@domain.ext)
   4. Send From command (FROM: m...@mydomain.ext)
   5. Send Data command to start message (DATA)
   6. (Optional) Set message Subject on its own line (SUBJECT: My email
   subject line followed by two enter key strokes)
   7. Enter data
   8. Terminate message with a period (.) on its own line to send message.

Some modern email clients do not do that period at the end of the message.
If your client terminates the connection before sending that termination
period, you will get some kind of error, most likely the one you are
seeing.  HOWEVER, if this is an externally originating email, there could
be a stray null character in the data stream.  A null character would be
the same as sending an empty string,  and even if the string had other
characters after the null, it would not be read.  Another possibility is
that you are using a Unicode character set wherein the two or four byte
character is being broken down to UTF-8 or worse, ASCII, and the border
between characters is translating as a transmission end character followed
by several other one-byte characters.  For the character mapping issue I am
referring to, look at
https://en.wikipedia.org/wiki/End-of-Transmission_character and see if you
are getting that.

Check your error queue for the message and see if there is anything in
there.

On Wed, Aug 4, 2021 at 1:59 AM Anupkumar Seth <anupkumar_s...@persistent.com>
wrote:

> Hi All,
>
> We are using James 2.3.2 in our production and started to see some issues
> for one of the customer who is using SMTP feature to send email to James
> and this email will be stored on local disk. Customer is using Zimbra mail
> server.
>
> We understand James 2.3.2 very old version and is out of support. But if
> anyone is still using James 2.3.2 and can help us on error that we are can
> see in James logs.
>
> Recently we found this conversation where Noel J. Bergman had offered to
> help on any issue on 2.3.2. please find the link below.
> https://www.mail-archive.com/server-dev@james.apache.org/msg70615.html
>
>
> Exception we see in James logs:
>
> 08/07/21 14:41:21 ERROR smtpserver-tls: Unknown error occurred while
> processing DATA.
> javax.mail.MessagingException: Error in input stream;
>   nested exception is:
>     java.net.ProtocolException: pre-mature end of data
>     at javax.mail.internet.InternetHeaders.load(InternetHeaders.java:365)
>     at org.apache.james.core.MailHeaders.<init>(MailHeaders.java:61)
>     at
> org.apache.james.smtpserver.DataCmdHandler.doDATA(DataCmdHandler.java:131)
>     at
> org.apache.james.smtpserver.DataCmdHandler.onCommand(DataCmdHandler.java:81)
>     at
> org.apache.james.smtpserver.SMTPHandler.handleConnection(SMTPHandler.java:393)
>     at
> org.apache.james.util.connection.ServerConnection$ClientConnectionRunner.run(ServerConnection.java:432)
>     at
> org.apache.excalibur.thread.impl.ExecutableRunnable.execute(ExecutableRunnable.java:55)
>     at
> org.apache.excalibur.thread.impl.WorkerThread.run(WorkerThread.java:116)
> Caused by: java.net.ProtocolException: pre-mature end of data
>     at
> org.apache.james.util.CharTerminatedInputStream.read(CharTerminatedInputStream.java:103)
>     at
> org.apache.james.util.watchdog.BytesReadResetInputStream.read(BytesReadResetInputStream.java:98)
>     at
> org.apache.james.util.DotStuffingInputStream.read(DotStuffingInputStream.java:50)
>     at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88)
>     at javax.mail.internet.InternetHeaders.load(InternetHeaders.java:342)
>     ... 7 more
>
> We have also found following code snippet from
> CharTerminatedInputStream.java which says the same.
>
>   if (b == -1) {
>                 //End of stream reached without seeing the terminator
>                 throw new java.net.ProtocolException("pre-mature end of
> data");
>    }
>
>
> We suspect that this error is thrown when there is no termination is sent
> by the email data and end of stream is reached. We also observer for some
> of the email transfer, after the DATA command is issued we also see RESET
> command in the middle of data transfer after which there is no data
> received from mail server, is this normal behaviour ?
>
>
> This issue is intermittent and does not happen for every email. We also
> cannot identify for which email transfer this error is thrown. We feel this
> issue may be due to some network related issue from Zimbra server which is
> failing to send full data to James server. Is our understanding correct
> here ?
>
> Any help will be really appreciated.
>
> Thanks & Regards,
> Anup
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is
> the property of Persistent Systems Ltd. It is intended only for the use of
> the individual or entity to which it is addressed. If you are not the
> intended recipient, you are not authorized to read, retain, copy, print,
> distribute or use this message. If you have received this communication in
> error, please notify the sender and delete all copies of this message.
> Persistent Systems Ltd. does not accept any liability for virus infected
> mails.
>

Reply via email to