Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 48912
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: PLOBBES [...] cpan.org
Requestors: icestar [...] inbox.ru
leszlauer.gabor [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 3.03
Fixed in: 3.24



Subject: wrong part numbers in multipart messages
Hello! It seems to me I've found a bug. IMAPClient not correctly calculates part numbers in multipart messages. I have a letter with one big attachment - another letter and in this attachment there are two other attachments. IMAPClient determined next part numbers: 1; 2; 2.1; 2.1.1; 2.1.2; 2.1.3 When I've tried to get part 2.1.2 with bodypart_string method I've got nothing. With experiments I've found out that right number is 2.2 So now I don't know how I can get correct part number to fetch it with bodypart_string. Thanks
Any chance you can submit a simple test case?
From: icestar [...] inbox.ru
On Fri Aug 21 23:21:58 2009, PLOBBES wrote: Show quoted text
> Any chance you can submit a simple test case?
I can. Here are two attachments. The first attach - letter.txt. This is initial letter text. The second attach - dump.txt. This is a dump of BODYSTRUCTURE and separated parts. As you can see part with xml file (mediaplan.xml) attachment has id '2.1.2', but in real I need to use id 2.2 to get it from IMAP server with method bodypart_string.

Message body is not shown because it is too large.

Message body is not shown because it is too large.

Confirmed, this is buggy. No patch at the moment but some day I'll try to get this fixed... unless someone gets around to this before me. Thanks for the report!
From: icestar [...] inbox.ru
On Wed Sep 23 01:32:47 2009, PLOBBES wrote: Show quoted text
> Confirmed, this is buggy. No patch at the moment but some day I'll
try Show quoted text
> to get this fixed... unless someone gets around to this before me. > Thanks for the report!
It seems to me BodyStructure parser doesn't work properly so we get one extra part with id 2.1
Subject: bug report
Date: Mon, 26 Apr 2010 15:10:22 +0200
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: Gábor Leszlauer <leszlauer.gabor [...] gmail.com>
Hi there! I hope you are doing well. I guess I found a bug in imapclient. The situation is the following: If someone sends an email with a message/rfc822 bodypart attachment, everything works fine as long as the rfc822 bodypart is part of the main email. Example: bodypart_id = 2. If the rfc822 bodypart has an other inner rfc822 bodypart, the body_id of the inner rfc822 bodypart would be something like 2.1.2. This bodypart cannot be fetched by $imap->bodypart_string($msgID, '2.1.2'), because the string imap gives you has no content. This fact is the same with more rfc822 bodyparts in depth. The first (id: 2) works fine, but the inner ones (2.1.2, 2.1.2.1.2, 2.1.2.1.2.1.2) aint. I hope I am right and this is really a bug. G.
I believe this is likely a dup of bug# 48912. This part of Mail::IMAPClient is buggy and definitely needs some work. Test cases and patches are certainly welcome!
Version 3.24 is out and with that, I patched Mail::IMAPClient::BodyStructure::bodystructure to properly assign parts for messages using multipart. It also now includes .TEXT parts as well. FWIW, it still does not including top level HEADER and TEXT though, but perhaps these are considered "givens" or not desired. I can't say for sure what everyone will think is correct/ideal behavior but hopefully these fixes get things working for you. Also, I also did a minor fix to _load_module() to set $@ and LastError if module load fails for some reason. Please feel free to reopen this bug or submit a new bug if you find problems with 3.24! PS. I placed the 'broken in' at 3.03 as I suspect it was broken there or perhaps even earlier but a comment in the test cases led me to believe at least 3.03 could have broken things.