Attachment Detection
On this page, we discuss the way to detect attachments coming from various e-mail clients.
We refer as "standard behavior" as this:
- Plain text messages: top mime part is a text/plain
- HTML messages: top mime part is a multipart/alternate with two children (text/plain and text/html), or it's directly a text/html.
- HTML messages with embedded images: top mime part is a multipart/related. One child is a multipart/alternate (see previous point). Other children are the embeded images.
- Message with attachments: top mime part is a multipart/mixed, with a child being the structure of non attachments messages (as we saw in previous points), and other children the attachments
- Signed message: top mime part is a multipart/signed.
Mime structure created in different clients
Let's keep 'm in alphabetical order :)
Evolution
Standard behavior.
Signed messages are multipart/signed.
Gmail
Standard behavior. Uses multipart/mixed for emails with attachments, multipart/alternative for hmtl/txt mails, multipart/related for html with images.
Hotmail
Standard behavior. Currently, windows live hotmail only supports plain text.
KMail
Standard behavior. Uses multipart/mixed for emails with attachments, multipart/alternative for html/txt mails, multipart/related for html with images.
Modest
Standard behavior.
Mutt
Standard behavior (but it does not support html messages)
Outlook / Outlook Express
Use the X-Ms-Has-Attach header (and if a mail has any of X-MS-* headers, _not_ having X-Ms-Has-Attach means there is _no_ attachment.
Outlook currently provides standard behavior also.
Special outlook format: send a file as the top mime part. The top mime part has the content type of the file.
PHP
PHP mail mime from pear has standard behavior.
SMIL (MMS) message
They have "Content-Type: Multipart/Related;" as the top-level. MMS message do not *always* contain images/video's, but I guess that "X-Mms-Message-ID:" and this Multipart/Related means it has an attachment.
Note: in fact we should interpret any smil message as having attachments, because we'll show the body of the smil message as an attachment in modest.
Squirrel
Standard behavior (only supports plain text messages).
Thunderbird
Standard behavior.
Web.de
Uses multipart/mixed for mails with attachments
Mime parsing in different clients
Standard behavior would be simply recognising top multipart/mixed to determine if it's an attachment.
Evolution
Standard behavior
GMail
It considers any multipart/related and multipart/mixed as message with attachments (then messages with embedded images only are considered as having attachments).
Modest/Tinymail
It considers (in imap):
- Any message with a size greater than 102400
- Any message having a X-MS-Priority field, unless it does not provide a X-MS-Has-Attachments field.
- Proposal: consider as having attachments nearly any message with multipart/mixed. We would exclude this way the outlook file as top mime part method.
Squirrel
Any multipart is considered as having attachments.
(last edited April 28, 2009) - Read Only
[info]
[diff])
FindPage by browsing or searching
5 best incoming links:
FrontPage (7), RecentChanges (5)
5 best outgoing links:
5 most popular nearby:
FrontPage (4627), RecentChanges (713)
|