Opened 5 years ago

Closed 5 years ago

#1485111 closed Feature Patches (fixed)

Corrupted MIME headers of messages in Sent folder

Reported by: Javer Owned by:
Priority: 2 Milestone: 0.2-beta
Component: MIME parsing Version: git-master
Severity: major Keywords:
Cc:

Description

I have created new message in html format, add attachment and send mail. Message was constructed correctly and sent, but then I see in Sent folder corrupted message, which source looks like this:

Content-Type: multipart/mixed;
	boundary="=_af390738b330610b94ac7493098a53b2";
	boundary="=_1fb986a9e9fa3f26e349f7535a85926e"

--=_1fb986a9e9fa3f26e349f7535a85926e
Content-Type: multipart/alternative;
	boundary="=_9daf87b9cced08d52c0d02aeb0a2ab1a"

--=_9daf87b9cced08d52c0d02aeb0a2ab1a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit

There are duplicate boundary for multipart/mixed MIME-part. This is because process of sending mail flows in following order:

$MAIL_MIME = new rcube_mail_mime(rcmail_header_delm());
...
$sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto);
        |-> ... $msg_body = $message->get(); ...
...
$saved = $IMAP->save_message($CONFIG[$store_target], 
   $MAIL_MIME->getMessage());
   |-> ... $body = $this->get($build_params); ...

We have duplicate call of get() method of Mail_mime class. And because each call of this method interprets separated html, plain, images, attachments parts and builds final MIME message, it add every time new multipart/mixed part around previously built message, and we have duplicate boundary and corrupted headers. This results in empty body while viewing message in Sent folder.
Patch provides caching of body of constructed MIME Message to avoid duplicate construction of message and damage of MIME headers.

Attachments (1)

rcube_mail_mime.diff (829 bytes) - added by Javer 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by Javer

comment:1 Changed 5 years ago by alec

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

Patch applied in [60881e5a].

Note: See TracTickets for help on using tickets.