6.0.0-beta1
7/26/25

[#14238] Attachment size = 0 for Microsoft email address
Summary Attachment size = 0 for Microsoft email address
Queue IMP
Queue Version Git master
Type Bug
State Not A Bug
Priority 1. Low
Owners Horde Developers (at)
Requester cbellmont (at) be-bound (dot) com
Created 02/02/2016 (3462 days ago)
Due
Updated 04/19/2016 (3385 days ago)
Assigned 04/19/2016 (3385 days ago)
Resolved 04/19/2016 (3385 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
04/19/2016 03:26:36 PM Michael Rubinsky Comment #10
State ⇒ Not A Bug
Reply to this comment
In fact, a quick google search seems to indicate this is a known issue 
with Outlook.com - though no solution is given:

http://answers.microsoft.com/en-us/outlook_com/forum/oemail-osend/outlookcom-hotmail-imap-issues-bodystructure/8b970e9d-8971-4cab-b0f8-1d3d51767b49

Closing, as it's not a Horde bug.
04/19/2016 03:20:57 PM Michael Rubinsky Comment #9
State ⇒ Feedback
Reply to this comment
Your IMAP server is not returning the body size data for that part. 
You will have to figure out why this is the case, it is not Horde that 
is doing it: The integer after the "BASE64" in the following response 
should be the size of the part.


C: 7 UID FETCH 100501 (BODYSTRUCTURE)
S: * 190 FETCH (UID 100501 BODYSTRUCTURE (("TEXT" "plain" ("charset" 
"utf-8" "format" "flowed") NIL NIL "7BIT" 2 1 NIL NIL NIL NIL)("image" 
"jpeg" ("name" "Happy_cat.jpg") NIL NIL "BASE64" 0 NIL ("attachment" 
("filename" "Happy_cat.jpg")) NIL NIL) "mixed" ("boundary" 
"------------060000010701080406020507") NIL NIL NIL))

03/15/2016 01:36:49 PM Michael Rubinsky State ⇒ Assigned
Assigned to Horde DevelopersHorde Developers
 
03/15/2016 11:37:27 AM carlos (dot) bellmont (at) gmail (dot) com Comment #8
New Attachment: horde logs.zip Download
Reply to this comment
Sorry for my late response.

I've include more logs in the attached file.It contains:

example email -> source code of the email.
code -> extract from my own code (20 lines and only related to Horde's 
management) which explain how to reproduce the error.
Example when it works fine (Gmail account):
gmail horde logs -> logs generated by horde (multiples operations included).
gmail fetch logs -> log the result of "fetch" (Horde operation). Pay 
attention to line:
[size] => 46276
[filename] => Happy_cat.jpg

Example when it doesn't work fine (Outlook account):
outlook horde logs -> logs generated by horde (multiples operations included).
outlook fetch logs -> log the result of "fetch" (Horde operation). Pay 
attention to line:
[size] => 0
[filename] => Happy_cat.jpg

03/08/2016 10:49:30 AM Jan Schneider State ⇒ No Feedback
 
02/17/2016 06:04:44 PM Michael Rubinsky Comment #7 Reply to this comment
Also, your sample email parses perfectly fine for me here:

               object(Horde_Support_CaseInsensitiveArray)#417 (1) {
                 ["storage":"ArrayIterator":private]=>
                 array(2) {
                   ["size"]=>
                   string(6) "751293"
                   ["filename"]=>
                   string(36) "Be-Friends - Issues Descriptions.pdf"
                 }
               }


WIth code:

$imap = $registry->mail->imapOb();
$mbox = new Horde_Imap_Client_Mailbox('Empty');
$query = new Horde_Imap_Client_Fetch_Query();
$query->structure();
$results = $imap->fetch($mbox, $query, array('ids' => new 
Horde_Imap_Client_Ids(array('229'))));
var_dump($results[229]->getStructure());
02/17/2016 05:51:44 PM Michael Rubinsky Comment #6 Reply to this comment
Are this one?
Yes, but the log doesn't contain the commands that fetched the email 
in question.
02/10/2016 05:23:51 PM cbellmont (at) be-bound (dot) com Comment #5
New Attachment: logs.zip Download
Reply to this comment
Are this one?
02/05/2016 03:30:34 PM Michael Rubinsky Comment #4 Reply to this comment
No, sorry.

I'm talking about the imap debug log - it shows the conversation 
between the client and server. This is enabled in 
imp/config/backends[.local].php.  We also need the raw source of an 
email message - what you would see in IMP, e.g., by clicking "View 
Message Source" .
02/05/2016 03:22:01 PM cbellmont (at) be-bound (dot) com Comment #3
New Attachment: Horde_Imap_Client_Fetch_Results Object Download
Reply to this comment
Hello Michael,

I've attached what I think you are looking for, please, don't hesitate 
to contact me again if I'm wrong or you need more information.

Thanks.
02/04/2016 04:19:13 PM Michael Rubinsky Comment #2
Priority ⇒ 1. Low
State ⇒ Feedback
Reply to this comment
The size data you are looking for is returned by the IMAP server in 
the body stucture in the FETCH response - it's not calculated by Horde.

For further support, please provide an IMAP debug log while you 
perform your debug code and the raw message text of a message that 
this occurs with.
02/02/2016 01:37:52 PM cbellmont (at) be-bound (dot) com Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
New Attachment: horde files.zip Download
Patch ⇒ No
Milestone ⇒
Queue ⇒ IMP
Summary ⇒ Attachment size = 0 for Microsoft email address
Type ⇒ Bug
Reply to this comment
The attachment's size is not properly retrieve for Microsoft accounts 
(Outlook, Hotmail...)

You can find attached the complete Horde_Mime_Part object.

Retrieving exactly the same email in Outlook and in Gmail, what I 
obtain when I use a Gmail account:

[Content-Disposition] => 
Horde_Mime_Headers_ContentParam_ContentDisposition Object
(
[_params:protected] => Horde_Support_CaseInsensitiveArray Object
(
[storage:ArrayIterator:private] => Array
(
[size] => 752364
  [filename] => Friends - Issues Descriptions.pdf
)
)
...

What I obtain if I use a Outlook account:

[Content-Disposition] => 
Horde_Mime_Headers_ContentParam_ContentDisposition Object
(
[_params:protected] => Horde_Support_CaseInsensitiveArray Object
(
[storage:ArrayIterator:private] => Array
(
[size] => 0
[filename] => Friends - Issues Descriptions.pdf
)
)
...

I generate the Horde_Mime_Part object as follow:
$mbox = new Horde_Imap_Client_Socket($param_arr);
$query = new Horde_Imap_Client_Fetch_Query();
$query->structure();
$result = $this->mbox->fetch('Inbox', $query, array('ids' => new 
Horde_Imap_Client_Ids($id)));
$structure = $result[0]->getStructure();

* Note, when the attachment is a plain text, the size is properly calculated.

Saved Queries