[dev] Getting attachments

Michael M Slusarz slusarz at horde.org
Tue Jan 14 08:39:26 UTC 2014


Quoting Michael J Rubinsky <mrubinsk at horde.org>:

> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>
>> Quoting Claus Ruete <claus.ruete at student.uni-tuebingen.de>:
>>
>>> Hi,
>>>
>>> i've been trying to get a list of attachments out of a  
>>> Horde_Mime_Part object, still, I can't get it to work, as I'm  
>>> looping through all subparts but $part->getDisposition() never  
>>> returns anything.
>>>
>>> I thought i'd get back something like "ATTACHMENT" but it just  
>>> returns null, so I tried finding out where the content-disposition  
>>> header can be found in the object by just using print_r($part) but  
>>> it didn't show up :(
>>
>> Content-Dispositon is not guaranteed to be present. You would be  
>> better off looking for non-text parts that do NOT have an in-line  
>> disposition set, or for text parts that are both not in the base  
>> mime-part and that do not have an attachment disposition set.  
>> Depending on what you are looking to do with the attachments, the  
>> requested disposition might be irrelevant anyway.
>
> ..and of course, that last condition should have been that do not  
> have an in-line disposition set.

Content-Disposition is pretty much useless when it comes to "attachments".

Because if you are talking about "attachments" as presented by a mail  
user agent... there is not objective standard to what an attachment  
is.  This has been discussed on this list previously (I believe I also  
made a somewhat lengthy post on this topic on the dovecot list in the  
past also.)  MIME messages can contain multiple "parts", but "parts"  
!= "attachments", if attachments is thought of as a discrete file.

Whatever an "attachment" is, it is a determination made by the  
application.  You can peruse IMP for example code on how we use the  
data provided by the MIME object to make our determination.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list