[Jmap] Attachments and composing more complex MIME structures

Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> Tue, 08 August 2017 09:23 UTC

Return-Path: <jeff.sipek@dovecot.fi>
X-Original-To: jmap@ietfa.amsl.com
Delivered-To: jmap@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id AD0B61204DA for <jmap@ietfa.amsl.com>; Tue, 8 Aug 2017 02:23:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i_odp0skW1Pq for <jmap@ietfa.amsl.com>; Tue, 8 Aug 2017 02:23:50 -0700 (PDT)
Received: from mail.dovecot.fi (wursti.dovecot.fi [94.237.32.243]) by ietfa.amsl.com (Postfix) with ESMTP id DC8F91288B8 for <jmap@ietf.org>; Tue, 8 Aug 2017 02:23:49 -0700 (PDT)
Received: from meili (officewifi.dovecot.fi [193.209.119.110]) by mail.dovecot.fi (Postfix) with ESMTPSA id 0CC3E2AF037 for <jmap@ietf.org>; Tue, 8 Aug 2017 12:24:22 +0300 (EEST)
Date: Tue, 08 Aug 2017 12:23:41 +0300
From: Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
To: jmap@ietf.org
Message-ID: <20170808092341.GB1457@meili>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
User-Agent: Mutt/1.8.3 (2017-05-23)
Archived-At: <https://mailarchive.ietf.org/arch/msg/jmap/NNpGf8_WdVAZK85Xfv9B7HeUWUs>
Subject: [Jmap] Attachments and composing more complex MIME structures
X-BeenThere: jmap@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: JSON Message Access Protocol <jmap.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jmap>, <mailto:jmap-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jmap/>
List-Post: <mailto:jmap@ietf.org>
List-Help: <mailto:jmap-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jmap>, <mailto:jmap-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 08 Aug 2017 09:23:52 -0000

Some clients (most notably iOS Mail app) often produce multipart/mixed
emails with inline text and images.  For example, if I compose a simple
email with no formatting and insert two images in the middle:

	This is a

	[inserted image]

	test of

	[another inserted image]

	iOS mail.

the email that gets produced has content-type multipart/mixed and there are
five parts (all at the top level with no nesting):

1. text/plain with "This is a"
2. image/png with the first inserted image
3. text/plain with "test of"
4. image/png with the second inserted image
5. text/plain with "iOS mail."

The image parts have inline content-disposition.

The attachment API (I'm not really sure what else to call it) as it is
currently described would work well for drafting what I think of as "email
with a bunch of attachments at the end" (that is parts with "attachment"
content disposition appended at the top-level of the MIME structure).
However, I don't think the attachment API can be used to draft one of these
inline-mime-image mails since setMessages:

1. assumes that the email text itself is one part (text/plain or text/html)
2. the attachment isInline property is meant only for HTML cid references

Did I miss something, or does this really mean that a client like this must
save drafts that are pre-composed RFC 5322 messages with all the inserted
images already embedded?  This breaks one of the exciting features of jmap -
not having to reupload all the attachments during auto-saving of drafts.

At some point on the list, Chris suggested providing a set of properties to
allow the clients to easily extract important content from the email.  Would
it make sense to extend the setMessages call to do the reverse?  That is,
assemble a RFC 5322 message from a body structure specified by the client?
I imagine each supplied body structure part to either specify text/plain or
text/html as a property, or specify the content type and disposition along
with a blob id.

The current draft has something like it, but it doesn't specify the actual
structure - just a list of attachment blobIds with some hints about their
use (i.e., the isInline property which seems to control the content
disposition, but not the placement of the part within the MIME structure).

Thanks,

Jeff.


P.S. For what it is worth, the iOS mail app produces a totally different
structure if any of the text has formatting.  (OSX Mail.app seems to always
produce it as well.)  For example, with the same content as above, but with
formatting applied to any of the text produces a multipart/alternative email
with:

1.   text/plain with the whole text without any images
2.   multipart/related
2.1. text/html with the whole text with <img> tags using cids to refer to
     the images
2.2. image/png with the first inserted image
2.3. image/png with the second inserted image