Re: [Jmap] Attachments and composing more complex MIME structures

Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> Tue, 08 August 2017 12:31 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 00F8413238B for <jmap@ietfa.amsl.com>; Tue, 8 Aug 2017 05:31:52 -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 fD5iWp2-8puJ for <jmap@ietfa.amsl.com>; Tue, 8 Aug 2017 05:31:50 -0700 (PDT)
Received: from mail.dovecot.fi (wursti.dovecot.fi [94.237.32.243]) by ietfa.amsl.com (Postfix) with ESMTP id E15DA132354 for <jmap@ietf.org>; Tue, 8 Aug 2017 05:31:49 -0700 (PDT)
Received: from meili (officewifi.dovecot.fi [193.209.119.110]) by mail.dovecot.fi (Postfix) with ESMTPSA id 44BD12AEF40 for <jmap@ietf.org>; Tue, 8 Aug 2017 15:32:26 +0300 (EEST)
Date: Tue, 08 Aug 2017 15:31:46 +0300
From: Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
To: jmap@ietf.org
Message-ID: <20170808123146.GD1457@meili>
References: <20170808092341.GB1457@meili> <1502188117.322839.1066636392.362BFD31@webmail.messagingengine.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <1502188117.322839.1066636392.362BFD31@webmail.messagingengine.com>
User-Agent: Mutt/1.8.3 (2017-05-23)
Archived-At: <https://mailarchive.ietf.org/arch/msg/jmap/qQ2KdoGr8FmNUst7WGIv_8mELvk>
Subject: Re: [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 12:31:52 -0000

On Tue, Aug 08, 2017 at 20:28:37 +1000, Neil Jenkins wrote:
> On Tue, 8 Aug 2017, at 07:23 PM, Josef 'Jeff' Sipek wrote:
> > Some clients (most notably iOS Mail app) often produce multipart/mixed> emails with inline text and images.
> 
> Although not clear yet (this bit of the spec needs a lot more details),
> the intention is that a JMAP server would convert this to an htmlBody in
> the Message object that combined the text and images (with cids).

I guessed that was the idea there.

> > However, I don't think the attachment API can be used to draft one of
> > these inline-mime-image mails since setMessages:
> 
> No, but you could produce an HTML part that's going to render the same
> (and be more compatible).

Is there a MIME-aware client that breaks with what the iOS client generates?
In theory the multipart/mixed approach should be *more* compatible than
HTML, since the client doesn't have to deal with HTML on top of dealing with
MIME anyway.

<personal preference>
As a mutt user that likes text/plain emails... it'd be great if these
generated emails displayed nicely with non-HTML based MUAs. :)

At the very least, the multipart/mixed emails render rather sanely in mutt.
</personal preference>

> > 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?
> 
> If the client absolutely MUST create a multipart/mixed email like this,
> then yes. The intention with the Message object format is to hide the
> complexities of MIME, and try to remove alternative ways of representing
> the same things. This makes it easier for client authors, at the expense
> of some more complexity for server developers.

I suppose the textBody/htmlBody approach should easily cover 80% of the use
cases.  The remaining 20% are possible via the importMessages call and raw
email upload for now, or an extension in the future.

Is the goal to make only the simplest of clients easy to implement?  Where
does one draw the line between simple enough to use the nice jmap interface
and too complex (IOW: just implement the whole RFC 5322/MIME/etc. stack and
use the blob API)?

> > P.S. For what it is worth, the iOS mail app produces a totally
> >      different> structure if any of the text has formatting.:
> > 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
> 
> Doesn't sound like it would be difficult for it just to always generate
> this even when no text formatting is applied then…

Agreed.

Thanks,

Jeff.