Bug 4167 - Max line length exceeded when forwarding mail
Summary: Max line length exceeded when forwarding mail
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: SMTP (show other bugs)
Version: 3.17.4
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2019-03-08 11:35 UTC by Keith Edmunds
Modified: 2019-04-21 12:49 UTC (History)
1 user (show)

See Also:


Attachments
About box (91.04 KB, image/png)
2019-03-08 12:49 UTC, Keith Edmunds
no flags Details
Mail that fails when forwarded (220.29 KB, text/plain)
2019-03-15 16:24 UTC, Keith Edmunds
no flags Details
fix (861 bytes, patch)
2019-04-07 17:56 UTC, Paul
no flags Details | Diff

Description Keith Edmunds 2019-03-08 11:35:08 UTC
Recently started happening (I'm using version 3.17.3git156).

When forwarding a mail, it sometimes fails with:

** error occurred on SMTP session
*** Error occurred while sending the message:
550 maximum allowed line length is 998 octets, got 1650

Only started happening in the last month or so.
Comment 1 Paul 2019-03-08 12:26:25 UTC
(In reply to comment #0)
> Recently started happening (I'm using version 3.17.3git156).

Current git version is 3.17.3git128.

3.17.3git156?
Comment 2 Keith Edmunds 2019-03-08 12:48:45 UTC
That's what the 'About' box says (see attached).

Last git log:

commit 9b0f657019e68cccfb86768f837540881c0e1790
Author: Michael Rasmussen <mir@datanom.net>
Date:   Sat Mar 2 13:25:13 2019 +0100

    Remove useless debug code. Add copyright
    
    Signed-off-by: Michael Rasmussen <mir@datanom.net>
Comment 3 Keith Edmunds 2019-03-08 12:49:24 UTC
Created attachment 1964 [details]
About box
Comment 4 Paul 2019-03-08 12:55:07 UTC
On a clean git pull that would be 3.17.3git113. (3.17.3-113-g9b0f657)
Comment 5 Keith Edmunds 2019-03-08 12:56:33 UTC
Looks like the 'About' box has a bug too, then.
Comment 6 Paul 2019-03-08 12:59:56 UTC
(In reply to comment #5)
> Looks like the 'About' box has a bug too, then.

No, not at all.
Comment 7 Keith Edmunds 2019-03-08 13:04:27 UTC
I'm not getting into a pissing contest over this: call it whatever version you want, but please don't question the git version in a bug report when it was copypasta from the About box.
Comment 8 Paul 2019-03-08 13:13:32 UTC
(In reply to comment #7)
> I'm not getting into a pissing contest over this: call it whatever version
> you want, but please don't question the git version in a bug report when it
> was copypasta from the About box.

You are the only one in the pissing contest, so you win.

I asked because there isn't an official 3.17.3git156 yet. And like I say a clean git checkout would not produce that version number, so I wanted you to confirm which version you are using, because git156 tells no-one anything.

However, this is a (known) problem of the way claws-mail handles versioning via git. It is not a criticism of you in any way, so no need to take it as one.
Comment 9 Paul 2019-03-13 12:41:25 UTC
Claws Mail warns you when attempting to send a message which exceeds the line length limit. A popup dialogue says:

Line %d exceeds the line length limit (998 bytes).
The contents of the message might be broken on the way to the delivery
Send it anyway?


Do you not see this?

What are your settings on the Wrapping page of the preferences?
Comment 10 Keith Edmunds 2019-03-14 22:11:44 UTC
I do not see that dialog in this context (I'm familiar with it, but it isn't being displayed when this bug occurs).

Wrapping settings: all four boxes ticked, wrap at 75 characters.

I don't believe this is a display/editing bug. I believe it is identifying a contravention of RFC2822 section 2.1.1, "Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF." The error I'm seeing is from the MUST clause; the wrapping settings and warning you refer to are from the SHOULD clause. I may be wrong, but that's my interpretaion.

I have forwarded mails using Claws for years. It is only in the past 4-6 weeks (using builds from git) that this problem has occurred.
Comment 11 Keith Edmunds 2019-03-15 16:24:37 UTC
Created attachment 1965 [details]
Mail that fails when forwarded

The attached mail fails as per this bug when forwarded. Git version of claws is commit cd9afd9b09881c116c7b932c2bd4643c96d0729f
Comment 12 Paul 2019-03-15 16:51:32 UTC
Thanks for the example mail.

It forwards fine here. I tried with 2 different servers.
Comment 13 Keith Edmunds 2019-03-15 18:58:11 UTC
That may be because your SMTP server doesn't reject mail with lines>998 bytes.

What I have done is compare the original mail with the one "stuck" in the Queue folder after forwarding. The original mail is (horrible) HTML,but this is an extract from it, and is three lines long:

<p class=3D"MsoNormal">Just thought I would drop you an email, I am now wor=
king with &nbsp;companies &nbsp;in your area doing regular confidential shr=
edding.<o:p></o:p></p>

The same section from the queued mail is one line long:

<p class="MsoNormal">Just thought I would drop you an email, I am now working with &nbsp;companies &nbsp;in your area doing regular confidential shredding.<o:p></o:p></p>

That particular line doesn't exceed the 998 byte count, but it's easy to see how it could.

To save the mails, I'm right-clicking on the message/rfc822 part and saving. I'm comparing the pre- and post-forwarded versions with meld (under Linux), which makes it a little easier to see than my preferred vimdiff.

You might want to compare the mail that is received after forwarding with the un-forwarded original.
Comment 14 Paul 2019-03-15 19:21:23 UTC
When forwarding a messages with line length exceeding 998 you will see that warning dialogue detailed in comment #9.

The example message that you attached does not exceed 998 bytes on any line, it is well wrapped.

This all suggests to me that you should enqure with the SMTP server operator regarding this problem.
Comment 15 Keith Edmunds 2019-03-15 20:17:49 UTC
> When forwarding a messages with line length exceeding 998 you will see
> that warning dialogue detailed in comment #9.

Agreed, but - as you state below - the message doesn't have any lines in it that exceed 998 bytes.

> The example message that you attached does not exceed 998 bytes on any
> line, it is well wrapped.

Agreed. That what I said in Comment #13.

> This all suggests to me that you should enqure with the SMTP server
> operator regarding this problem.

You're ignoring the fact that, as described in Comment #13, claws appears to be changing this particular message when forwarding such that the line length does exceed 998 bytes.
Comment 16 Keith Edmunds 2019-03-15 20:28:15 UTC
Step by step instructions to demonstrate the problem. Starting point: the attached mail is present in your inbox.

1. Select mail
2. Menu: Message, forward
3. Insert an address it the To: box
4. Menu: Message, Send later
5. Select the message in the Queue folder
6. Menu: File, Save email as...
7. In a shell window:

$ wc -L themessage.eml 
1372 themessage.eml

(Note: the -L switch to wc only works on Linux, not MacOS. It displays the length of the longest line in the file argument).
Comment 17 Paul 2019-03-15 21:28:50 UTC
(In reply to comment #15)
> You're ignoring the fact that, as described in Comment #13, claws appears to
> be changing this particular message when forwarding such that the line
> length does exceed 998 bytes.

Not ignoring, just somehow overlooked it completely.

But, yes, I can confirm what you said.
Comment 18 Paul 2019-04-07 17:56:04 UTC
Created attachment 1971 [details]
fix

Try this patch.
Comment 19 users 2019-04-21 12:45:04 UTC
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

++ ChangeLog	2019-04-21 12:45:03.969267969 +0200
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=1a25c3d8e2868e34a2c5f63d63958f4030dbb207
Author: Paul <paul@claws-mail.org>
Date:   Sun Apr 21 11:44:00 2019 +0100

    fix bug 4167, 'Max line length exceeded when forwarding mail'

Note You need to log in before you can comment on or make changes to this bug.