[Dovecot] Check if a message has attachments
Antoine Nguyen
ngu.antoine at gmail.com
Fri Jan 14 23:16:26 EET 2011
2011/1/14 Michael M. Slusarz <slusarz at curecanti.org>
> You should only need the structure for each message, which you can get with
> BODYSTRUCTURE command.
>
Indeed I should be able to achieve what I'm looking for with this command.
>
> But beware that determination of what is an "attachment" is not so
> straight-forward. The Content-Disposition header (RFC 2183), if it even
> exists, is often not useful.
>
> Take these examples:
>
> * Message with a single application/pdf part. Is this an attachment? Many
> users would say yes. But what if Content-Disposition does exist and is set
> to 'inline'.
>
> * multipart/mixed part, with a single text/plain child part. This is most
> likely not an attachment, at least by an end user definition, and shows that
> you can't just search for 'multipart' in the Content-Type field.
>
> * multipart/related part with two embedded parts, text and HTML. Again,
> most likely users would not expect this to be an attachment.
>
> * multipart/related part with two embedded parts, one text and one PDF. If
> PDF can't be displayed in the MUA, should it be considered an attachment,
> even though it lives in a multipart/related part? (e.g. the text part is
> intended to be displayed as a quick view of the PDF, but loses all of the
> formatting contained in the PDF.)
>
> And so on.
>
> michael
>
Ok, I understand. It seems I need to think my code as flexible as possible
because I would certainly have to add unsupported combinations in the
future... By the way, thanks for your answer.
Antoine
More information about the dovecot
mailing list