The following issue has been CLOSED ====================================================================== http://www.dbmail.org/mantis/view.php?id=960 ====================================================================== Reported By: RandomBits Assigned To: ====================================================================== Project: DBMail Issue ID: 960 Category: IMAP daemon Reproducibility: sometimes Severity: major Priority: normal Status: closed target: Resolution: unable to reproduce Fixed in Version: ====================================================================== Date Submitted: 22-Feb-12 22:58 CET Last Modified: 06-Sep-12 09:26 CEST ====================================================================== Summary: Multipart MIME messages are not reconstructed properly Description: When dbmail reconstructs some Multi-part messages, it reconstructs the MIME parts like this:
--Separator Begin data part --Separator Begin --Separator End-- data part More complicated messages have different errors as desscribed in the "Additional Information" section. This occurs in the 3.0.0-1 release as well as the latest git from 2012-02-21 referenced above. It does not happen on all MIME multi-part messages. In my mail flow it affects about 1/20 messages and I haven't discerned a pattern. ====================================================================== ---------------------------------------------------------------------- (0003409) paul (administrator) - 23-Feb-12 01:01 http://www.dbmail.org/mantis/view.php?id=960#c3409 ---------------------------------------------------------------------- apparently the test-cases need to be expanded for more complex mime structures. the code is in: - retrieval/reconstruction src/dbmail-message.c, _mime_retrieve() - test messages test/check_dbmail.h - unit-tests test/check_dbmail_message.c, test_dbmail_message_store ---------------------------------------------------------------------- (0003410) RandomBits (reporter) - 23-Feb-12 03:39 http://www.dbmail.org/mantis/view.php?id=960#c3410 ---------------------------------------------------------------------- Thanks for the code pointers. I did a little investigating and found that the database contents seem correct. Here is the diagnostic query I used: SELECT l.part_key,l.part_depth,l.part_order,l.is_header, mp.data FROM dbmail_mimeparts p JOIN dbmail_partlists l ON p.id = l.part_id JOIN dbmail_mimeparts mp ON mp.id = l.part_id JOIN dbmail_physmessage ph ON ph.id = l.physmessage_id WHERE l.physmessage_id = ***PHYSMESSAGEID*** ORDER BY l.part_key,l.part_order ASC I'm going to take a stab at the code and see if I can follow the logic enough to get it working. Here is what I expect to see once the message has been rebuilt: [Message headers] Content-Type: multipart/related; boundary="----=_Part_228805_1858578061.1329804655776" ------=_Part_228805_1858578061.1329804655776 Content-Type: multipart/alternative; boundary="----=_Part_228806_1971825612.1329804655776" ------=_Part_228806_1971825612.1329804655776 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit [plain-text content] ------=_Part_228806_1971825612.1329804655776 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit [HTML content] ------=_Part_228805_1858578061.1329804655776-- [this ends the multipart-alternative text/HTML content] ------=_Part_228805_1858578061.1329804655776 Content-Type: image/png; name=logo.png Content-Transfer-Encoding: base64 Content-Disposition: inline; filename=logo.png Content-ID: <logo.png> Content-Description: /logo.png [PNG CONTENT] ------=_Part_228805_1858578061.1329804655776 Content-Type: image/png; name=error.png Content-Transfer-Encoding: base64 Content-Disposition: inline; filename=error.png Content-ID: <error.png> Content-Description: /error.png [PNG CONTENT] ------=_Part_228805_1858578061.1329804655776 Content-Type: image/png; name=icon1.png Content-Transfer-Encoding: base64 Content-Disposition: inline; filename=icon1.png Content-ID: <icon1.png> Content-Description: /icon1.png [PNG CONTENT] ------=_Part_228805_1858578061.1329804655776 Content-Type: image/png; name=icon2.png Content-Transfer-Encoding: base64 Content-Disposition: inline; filename=icon2.png Content-ID: <icon2.png> Content-Description: /icon2.png [PNG CONTENT] ------=_Part_228805_1858578061.1329804655776 Content-Type: image/png; name=button.png Content-Transfer-Encoding: base64 Content-Disposition: inline; filename=button.png Content-ID: <button.png> Content-Description: /button.png [PNG CONTENT] ------=_Part_228805_1858578061.1329804655776 Content-Type: image/png; name=icon3.png Content-Transfer-Encoding: base64 Content-Disposition: inline; filename=icon3.png Content-ID: <icon3.png> Content-Description: /icon3.png [PNG CONTENT] ------=_Part_228805_1858578061.1329804655776-- ---------------------------------------------------------------------- (0003411) RandomBits (reporter) - 23-Feb-12 04:26 http://www.dbmail.org/mantis/view.php?id=960#c3411 ---------------------------------------------------------------------- No luck. I wasn't able to wrap my brain around the reconstitution logic. ---------------------------------------------------------------------- (0003412) paul (administrator) - 23-Feb-12 11:49 http://www.dbmail.org/mantis/view.php?id=960#c3412 ---------------------------------------------------------------------- The separator ending the multipart/alternative in your penultimate note is incorrect. With the corrected separator it passes the tests. ---------------------------------------------------------------------- (0003413) RandomBits (reporter) - 23-Feb-12 19:10 http://www.dbmail.org/mantis/view.php?id=960#c3413 ---------------------------------------------------------------------- The m/a separator looks correct to me (except for " [this ends the multipart-alternative text/HTML content]" comment which is not part of the separator.) Was there anything else wrong with it? Just wanted to add that my inability to comprehend the code was related to time constraints, lack of my usual IDE, and limits of my knowledge. It was not commentary about the code quality. ---------------------------------------------------------------------- (0003414) RandomBits (reporter) - 24-Feb-12 07:56 http://www.dbmail.org/mantis/view.php?id=960#c3414 ---------------------------------------------------------------------- I just encountered a really simple 2-part MIME message (with some non-MIME text at the top) that was reconstructed like this despite the fact that the database contents seem to be in the correct order [comments are in brackets]: [HEADERS] Content-Type: multipart/alternative; boundary="KMn2h58bMQCp=_?:" This is a multi-part message in MIME format. --KMn2h58bMQCp=_?: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [HTML Content where the text/plain content should be] --KMn2h58bMQCp=_?:-- [Wrong separator, should be the beginning of the next part] [Text content where nothing should be] --(null) [What is going on here?] Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [No ending boundary] [END MESSAGE] This is how I would expect it to be presented: [HEADERS] Content-Type: multipart/alternative; boundary="KMn2h58bMQCp=_?:" This is a multi-part message in MIME format. --KMn2h58bMQCp=_?: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [Text Content] --KMn2h58bMQCp=_?: Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [HTML Content] --KMn2h58bMQCp=_?:-- [END MESSAGE] This is how it's represented in the database: part_key part_depth part_order is_header data 1 0 0 1 [HEADERS]\nContent-Type: multipart/alternative; boundary="KMn2h58bMQCp=_?:"\n 1 0 1 0 This is a multi-part message in MIME format.\n 2 1 0 1 Content-Type: text/plain;\r\n charset="us-ascii"\r\nContent-Transfer-Encoding: quoted-printable\r\n 2 1 1 0 [Text Content] 3 1 0 1 Content-Type: text/html;\r\n charset="us-ascii"\r\nContent-Transfer-Encoding: quoted-printable\r\n 3 1 1 0 [HTML Content] 3 0 3 0 \n [That's it for this field, just a linefeed] Issue History Date Modified Username Field Change ====================================================================== 22-Feb-12 22:58 RandomBits New Issue 22-Feb-12 22:59 RandomBits Issue Monitored: RandomBits 23-Feb-12 01:01 paul Note Added: 0003409 23-Feb-12 03:39 RandomBits Note Added: 0003410 23-Feb-12 04:26 RandomBits Note Added: 0003411 23-Feb-12 11:49 paul Note Added: 0003412 23-Feb-12 19:10 RandomBits Note Added: 0003413 24-Feb-12 07:56 RandomBits Note Added: 0003414 06-Sep-12 09:26 paul Status new => closed 06-Sep-12 09:26 paul Resolution open => unable to reproduce ====================================================================== _______________________________________________ Dbmail-dev mailing list Dbmail-dev@dbmail.org http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev