[#7671] Problem with Compose and attachment
Summary Problem with Compose and attachment
Queue IMP
Queue Version HEAD
Type Bug
State Resolved
Priority 1. Low
Owners
Requester rsalmon (at) mbpgroup (dot) com
Created 11/12/2008 (234 days ago)
Due
Updated 12/29/2008 (187 days ago)
Assigned 11/16/2008 (230 days ago)
Resolved 11/16/2008 (230 days ago)
Attachments email.eml Download
mime_part.patch Download
Milestone
Patch No

History
12/29/2008 rsalmon (at) mbpgroup (dot) com Comment #11 Reply to this comment
I've changed it to:
         return base_convert(dechex(strtr(microtime(), array('0.' => 
'', ' ' => ''))) . uniqid(mt_rand(), true), 16, 36);

in git.
Can someone update cvs branches as well? HEAD,FRAMEWORK and probably 
groupwares
thanks.

12/23/2008 Chuck Hagenbuch Comment #10 Reply to this comment
I've changed it to:
         return base_convert(dechex(strtr(microtime(), array('0.' => 
'', ' ' => ''))) . uniqid(mt_rand(), true), 16, 36);

in git.
12/23/2008 rsalmon (at) mbpgroup (dot) com Comment #9 Reply to this comment
So long as the same problem doesn't happen with that code...
I found the problem.
It comes from MIME::generateRandomID(). The random ID generated is not 
uniq. When you call this function several time within a sort period of 
time, you always get the same random ID.

quick fix which works here :
     function generateRandomID()
     {
//        return base_convert(dechex(strtr(microtime(), array('0.' => 
'', ' ' => ''))) . uniqid(), 16, 36);
         return md5(microtime());
     }

hope this helps.

11/16/2008 Chuck Hagenbuch Comment #8 Reply to this comment
So long as the same problem doesn't happen with that code...
11/16/2008 Michael Slusarz Comment #7
Taken from Michael Slusarz
State ⇒ Resolved
Reply to this comment
IMP 5/new MIME library is less than a week away from being stable 
enough to replace the current CVS HEAD code, so I am not going to look 
at this.  If someone else wants to, they are more than welcome.
11/16/2008 Chuck Hagenbuch Comment #6
Assigned to Michael Slusarz
State ⇒ Assigned
Reply to this comment
I can confirm the problem.
11/14/2008 rsalmon (at) mbpgroup (dot) com Comment #5
New Attachment: mime_part.patch Download
Reply to this comment
Possible patch.
It solves the bug we're having.
but the patch creates an other problem : it does add 2 ending boundary 
at the end of the email.
11/14/2008 rsalmon (at) mbpgroup (dot) com Comment #4 Reply to this comment
I've added a debug line to imp/lib/Compose.php
--- Compose.php.orig        2008-11-14 11:31:45.000000000 +0100
+++ Compose.php        2008-11-14 11:35:20.000000000 +0100
@@ -856,6 +856,7 @@
                  }
              }

+                        Horde::logMessage(print_r($mime_message,true), __FILE__, __LINE__, 
PEAR_LOG_ERR);
              /* Add the body text to the message string. */

which gives me the following parts of the email :
     [_type] => multipart
     [_subtype] => mixed
           [_parts] => Array
                 (
                     [1] => MIME_Part Object
                         (
                             [_type] => multipart
                             [_subtype] => mixed
                             [_parts] => Array
                                 (
                                     [1] => MIME_Part Object
                                         (
                                             [_type] => multipart
                                             [_subtype] => alternative
                                             [_parts] => Array
                                                 (
                                                     [1] => MIME_Part Object
                                                         (
                                                             [_type] => text
                                                             
[_subtype] => plain
                                                     [2] => MIME_Part Object
                                                         (
                                                             [_type] => text
                                                             [_subtype] => html
                                     [2] => MIME_Part Object
                                         (
                                             [_type] => image
                                             [_subtype] => jpeg



I'm guessing the problem is coming from function MIME_Part:::toString.
when toString is called : part 1.1 (so part 1.1.1 and  1.1.2)  are 
processed and then an ending boundary is added for the first time. 
then part 1.2 is processed and an ending boundary is added for the 
second time.

Is this correct ?

11/12/2008 rsalmon (at) mbpgroup (dot) com Comment #3 Reply to this comment
And what _is_ the problem?
Sorry,
I can't see the attachment in IMP.
11/12/2008 Chuck Hagenbuch Comment #2
Summary ⇒ Problem with Compose and attachment
Reply to this comment
And what _is_ the problem?
11/12/2008 rsalmon (at) mbpgroup (dot) com Comment #1
New Attachment: email.eml Download
Patch ⇒
Milestone ⇒
Summary ⇒ Pb with Compose and attachment
Type ⇒ Bug
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Queue ⇒ IMP
Reply to this comment
using the latest CVS version, compose editor is FCKEditor.

How to reproduce :
compose a new email, add text, add an attachment. and send it.

I've attached a copy of the email that has been sent.

I'm not familiar with boundaries, but it seems that the ending 
boundary is added just before the attachment.

I have a CVS copy of horde/IMP from the 07/10/2008, and it was working.