Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#1486175 closed Bugs (wontfix)

Mail message is shown with empty body

Reported by: gardiol Owned by:
Priority: 3 Milestone: 0.3.1
Component: MIME parsing Version: git-master
Severity: major Keywords: blank body empty message
Cc: willy@…, robert.penz, atd

Description

Please refer to this thread:

http://www.roundcubeforum.net/pending-issues/5439-blank-empty-message-body-see-email-source-inside.html#post21806

for detailed description including example of not-working email.

This bug is serius. Reported by three users so far. Any(!) other mail client shows the incriminated message.

This happens with both 0.3 and trunk (23 sept 2009).

Attachments (5)

email.eml (2.5 KB) - added by gardiol 4 years ago.
Incriminated blank body mail
email2.eml (3.7 KB) - added by gardiol 4 years ago.
Other blank email message (same thread)
imap2.txt (2.5 KB) - added by gardiol 4 years ago.
imap_debug trace
imap3.txt (3.4 KB) - added by gardiol 4 years ago.
More verbose IMAP trace
roundcubemail-0.3-stable.cpanel.patch (1.3 KB) - added by cpanelphil 4 years ago.
Experimental patch to detect malformed BODYSTRUCTURE and treat as raw body

Download all attachments as: .zip

Change History (27)

Changed 4 years ago by gardiol

Incriminated blank body mail

comment:1 Changed 4 years ago by alec

  • Component changed from User Interface to MIME parsing
  • Milestone changed from later to 0.3.1

Works for me, so we need more info. What IMAP server and BODYSTRUCTURE response?

comment:2 Changed 4 years ago by gardiol

IMAP server is qmail(?), how do i check the other? The problem sometimes shows up like this:

  • send an email from hotmail to me
  • reply from me to hotmail
  • replay back will show blank body

Not always, only sometimes. Seems to happen more often if i use the roundcube html editor.

comment:3 follow-up: Changed 4 years ago by alec

So, we need the all messages source. To check BODYSTRUCTURE you'll need to enable imap_debug option. This will create logs/imap file.

comment:4 in reply to: ↑ 3 Changed 4 years ago by gardiol

Replying to alec:

So, we need the all messages source. To check BODYSTRUCTURE you'll need to enable imap_debug option. This will create logs/imap file.

First of all, i try to upload another email message that does not show up, its part of the same thread. I have not saved the rest of the thread, only the last two messages. When i noticed the problem i had already deleted the older messages.

Attached is also the log from imap_debug relative to when i openend the attached email.

Changed 4 years ago by gardiol

Other blank email message (same thread)

Changed 4 years ago by gardiol

imap_debug trace

comment:5 follow-up: Changed 4 years ago by alec

email2.eml also works for me. The trace is not complete. We need trace from opening the message, maybe it's cached, enable devel_mode option.

comment:6 in reply to: ↑ 5 ; follow-up: Changed 4 years ago by gardiol

I have added the extended trace with devel_mode set to true in config/main.php.inc
Maybe you can check the forum post above and get more non working emails from there? I can only post mine...

Changed 4 years ago by gardiol

More verbose IMAP trace

comment:7 in reply to: ↑ 6 Changed 4 years ago by alec

Replying to gardiol:

I have added the extended trace with devel_mode set to true in config/main.php.inc
Maybe you can check the forum post above and get more non working emails from there? I can only post mine...

Your mail works for me. That trace is not enought. You have probably BODYSTRUCTURE cached in DB. If so, try with sql_debug.

comment:8 Changed 4 years ago by robert.penz

I'm running courier as imap server and have the same problem. I've root access on the server and did take a look at the mail file on the server. I copied the file also to an other user, same problem. Here is the file directly from the server, if I remove the empty line after "X-OriginalArrivalTime:" every works!

Delivered-To: xxxxx@penz.name
Return-Path: <xxxxx@hotmail.com>
Received: from bay0-omc2-s6.bay0.hotmail.com (bay0-omc2-s6.bay0.hotmail.com [::ffff:65.54.246.142])
  by mail.penz.name with esmtp; Fri, 25 Sep 2009 09:23:16 +0200
  id 00000000006DC02A.000000004ABC6FE5.0000161B
Received: from BAY134-W14 ([65.55.139.49]) by bay0-omc2-s6.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959);
         Fri, 25 Sep 2009 00:17:45 -0700
Message-ID: <BAY134-W141C4AA5D45CB4832B5437EDD90@phx.gbl>
Old-Return-Path: xxxxxx@hotmail.com
Content-Type: multipart/alternative;
        boundary="_8549772e-d023-4457-a318-d9f5977c3ac6_"
X-Originating-IP: [xxx.xxx.xxx.xxx]
From: Martina xxxxxx <xxxxx@hotmail.com>
To: "xxxx xxxxx" <xxxx@penz.name>,
      karin xxxxx <xxxx@hotmail.com>
Subject: RE: hochzeit carolina
Date: Fri, 25 Sep 2009 07:17:45 +0000
Importance: Normal
In-Reply-To: <1816a1c66e5a3879837c8ad903fc4018@localhost>
References: <25474ef299f218fc5c0250a608b61c5b@localhost>
 <COL105-W354DCE7C039A55F68BF5ACF2DB0@phx.gbl>
X-OriginalArrivalTime: 25 Sep 2009 07:17:45.0680 (UTC) FILETIME=[47833500:01CA3DB0]


 <1816a1c66e5a3879837c8ad903fc4018@localhost>
MIME-Version: 1.0

--_8549772e-d023-4457-a318-d9f5977c3ac6_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable


hallo=2C

.......

--_8549772e-d023-4457-a318-d9f5977c3ac6_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<html>

...........

</html>=

--_8549772e-d023-4457-a318-d9f5977c3ac6_--

comment:9 Changed 4 years ago by alec

Robert, your message is another story. It's not proper MIME mail, so probably your server is unable to response with proper BODYSTRUCTURE. Check this as stated in comments to this ticket.

comment:10 Changed 4 years ago by robert.penz

@alec: Everything worked with roundcube 0.2 for month, as soon as I did an upgrade to 0.3 it stopped for some mails. Nothing has been changed on the imap server part or the MTA.

comment:11 Changed 4 years ago by robert.penz

  • Cc robert.penz added

comment:12 follow-up: Changed 4 years ago by atd

  • Cc atd added

comment:13 in reply to: ↑ 12 ; follow-up: Changed 4 years ago by gardiol

Replying to atd:

This is getting more and more annoying, now it happens to all the threads i exchange with hotmail people:

i write them -> OK
they anwser back -> OK
i answer back -> OK
they answer back -> BLANK...

Even this is a hotmail problem, any other email client i use (horde, kmail) shows the body with no problem, so i believe it should be fixed anyway.

I will try something, them post back here.

comment:14 in reply to: ↑ 13 ; follow-up: Changed 4 years ago by gardiol

I confirm, this happens ONLY after Hotmail replyes to a message that roundcube has sent after receiving it from Hotmail...

I tryied to study a bit the RC sources but i got stuck. I do not know enough of PHP/AJAX to understand the mess... sorry i cannot do much more myself!

comment:15 in reply to: ↑ 14 Changed 4 years ago by gardiol

Ok, anybody can check and confirm this bug. Just open up a hotmail account and send back and forth an email...

Also, a "broken" email shows up like this in horde, while it shows up blank in RC:

Data:   	 Thu, 1 Oct 2009 07:49:59 +0000 [09:49:59 CEST]
Da:  	 removed <removerd@hotmail.com>
A:  	me <me@gardiol.org>
Oggetto:  	RE: Scusami...
Intestazioni:  	Mostra Tutte le Intestazioni

 <f4519316fcee74439c086f6a95c85155@127.0.0.1>
MIME-Version: 1.0

--_9bacaa67-7e67-4bd4-a97c-8d784ebdc8a2_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable


non =E8 che ci tengo=2C ma non possiamo blah blah blah


=20

As you can see, the message is really broken, BUT RC should show it anyway, even broken.

comment:16 Changed 4 years ago by alec

  • Resolution set to wontfix
  • Status changed from new to closed

The message is broken, but Dovecot is able to return proper BODYSTRUCTURE. So it's hotmail's but also your IMAP server issue. Currently Roundcube relies on BODYSTRUCTURE reply. There are tickets in trac to handle raw messages if BODYSTRUCTURE is broken. We need to see what is bodystructure for those messages (there's no such info in attached debug listings).

Changed 4 years ago by cpanelphil

Experimental patch to detect malformed BODYSTRUCTURE and treat as raw body

comment:17 Changed 4 years ago by cpanelphil

See attachment roundcubemail-0.3-stable.cpanel.patch above.

In rcube_message.php, if the call to $this->imap->get_structure returns false, it treats the rest of the message as a raw body. This mimics the behavior of other mail clients that are at least showing a munged message.

I am detecting a specific pattern of NILs in the return of the BODYSTRUCTURE call (see the example in the comment in the patch). Is there a more robust way to detect this?

comment:18 follow-up: Changed 4 years ago by alec

Some servers returns different "bogus bodystructure". That's my proposition (from current rcube_imap.php):

/*
        @TODO: here we can recognize malformed BODYSTRUCTURE and parse
        the message in other way to create our own message structure.
        Example of structure for malformed MIME message:
        ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL)

        if ($headers->ctype != 'text/plain'
          && !is_array($structure[0]) && $structure[0] == 'text'
          && !is_array($structure[1]) && $structure[1] == 'plain')
          { }
      */

comment:19 in reply to: ↑ 18 Changed 4 years ago by gardiol

I can confirm that both patches works properly with my malformed hotmail messages. The second one looks better tough, seems more general.

Thank you people!

comment:20 Changed 4 years ago by robert.penz

where do I need to insert the second patch? can someone make a diff for it also? thx.

comment:21 Changed 4 years ago by atd

I also tried to apply it but didn't know how to

comment:22 Changed 4 years ago by alec

Note: See TracTickets for help on using tickets.