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

Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> Wed, 09 August 2017 10:45 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 7A0B3126B6D for <jmap@ietfa.amsl.com>; Wed, 9 Aug 2017 03:45:29 -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 Ws9le_l_Ir2f for <jmap@ietfa.amsl.com>; Wed, 9 Aug 2017 03:45:27 -0700 (PDT)
Received: from mail.dovecot.fi (wursti.dovecot.fi [94.237.32.243]) by ietfa.amsl.com (Postfix) with ESMTP id 40EB112009C for <jmap@ietf.org>; Wed, 9 Aug 2017 03:45:27 -0700 (PDT)
Received: from meili (officewifi.dovecot.fi [193.209.119.110]) by mail.dovecot.fi (Postfix) with ESMTPSA id 6BF2F284421; Wed, 9 Aug 2017 13:46:04 +0300 (EEST)
Date: Wed, 09 Aug 2017 13:45:14 +0300
From: Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
To: Neil Jhaveri <neil@neiljhaveri.com>
Cc: Neil Jenkins <neilj@fastmailteam.com>, jmap@ietf.org
Message-ID: <20170809104514.GA1412@meili>
References: <20170808092341.GB1457@meili> <1502188117.322839.1066636392.362BFD31@webmail.messagingengine.com> <BF5DBECF-F4EC-4137-9B45-F6A777755459@neiljhaveri.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <BF5DBECF-F4EC-4137-9B45-F6A777755459@neiljhaveri.com>
User-Agent: Mutt/1.8.3 (2017-05-23)
Archived-At: <https://mailarchive.ietf.org/arch/msg/jmap/9WqJcOQknaKe3E5PNZeBQdn7OII>
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: Wed, 09 Aug 2017 10:45:29 -0000

On Tue, Aug 08, 2017 at 11:17:41 -0700, Neil Jhaveri wrote:
> Yeah, the Apple Mail clients have a preference to avoid sending text/html,
> unless strictly necessary by the content:
...
> 
> How do other people here feel about the preference for text/plain?

Personally, I really like this preference for text/plain.  (Note that my
setup is strange since I use iOS on my phone and mutt on my laptop &
desktop.)

One important thing to point out about text/plain is that there are two ways
to treat it when composing the email:

1. the "unix" way, with ~80 column wrap consisting of inserted newlines, or
2. the "iOS" way, with no wrapping.

For example, if I write a paragraph of text with the iOS client, I end up
with a quoted-printable text/plain email that relies on the client to do the
wrapping since the paragraph is just one really long line.

In other words, text/plain is not inherently bad even without format=flowed.
Yes, it is not perfect, but in my opinion it works quite well even in fancy
mobile environments.

> On Aug 8, 2017, at 3:28 AM, Neil Jenkins <neilj@fastmailteam.com> wrote:
...
> There is also the uglier case of "inlined attachments" that cannot be
> properly referenced by HTML tags, e.g.:
> 	[plain text]
> 	[zip attachment]
> 	[more plain text]
> 
> I think the Apple clients are the only ones that even support this in the
> UI and make a multipart/mixed message out of it, but I’m not sure. Does
> anybody know if any other major clients offer this kind of UX?

IIRC, Lotus Notes supports (supported?) this as well.  It's been almost a
decade since I last used it so things may have changed since.

> I’ve personally never been a fan of it at all, and I think the resultant
> message looks confusing in some other MUAs, but it does have some
> occasional use. My hunch is that it only affects the Apple clients, so it
> doesn’t seem worth complicating matters here.

I'm not sure we can totally ignore this.  Even if Apple clients stop
generating these messages today, there are years worth of existing emails
using this kind of MIME structure.  Emails that clients will attempt to
fetch via jmap.

If we totally punt on this in jmap as part of the Message object (i.e., the
jmap server sends back some form of a message-too-complex error), any client
that wants to parse one of these mails sent by Apple clients will have to go
via the blob API and do its own MIME parsing.

Alternatively, we could make the server generate some sort of
text/{plain,html} view of the email to stuff into {text,html}Body when a
client attempts to fetch the mail.  In this case, we should probably specify
what the server should do as a bare minimum.  (E.g., the server MUST
support generating a HTML and plain text versions of arbitrary MIME
structures.)  Needless to say, this can lead to all sort of fun i18n/l10n
server-side issues.

(Now I'm curious what the FastMail client & server code does when it gets
one of these Apple client created emails...)

Actually, this makes me wonder... what should a jmap server do if the stored
message is somehow malformed?  There is a lot of broken email out there, and
the draft seems silent about how to handle them.

Jeff.