Lacking Natural Simplicity (Posts about mime)https://tkurtbond.github.io/categories/mime.atom2024-01-23T18:49:41ZT. Kurt BondNikolaMIME and Gmail vs other mailershttps://tkurtbond.github.io/posts/2020/12/11/mime-and-gmail-vs-other-mailers/2020-12-11T09:12:17-05:002020-12-11T09:12:17-05:00T. Kurt Bond<p>I composed a carefully constructed <a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a> message using <a class="reference external" href="http://www.mew.org/">Mew</a>, which has
a nice way to build <a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a> messages, but Gmail doesn’t know that if you
have a multipart <a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a> message that has a text part, then an image,
then a text part, then an image, then a text part then what you want
is for the image parts to be displayed inline. In messages like that
composed in Gmail, it uses the content type of <code class="docutils literal">multipart/related</code>,
which then encloses a <code class="docutils literal">multipart/alternative</code>, which has a plain
text version of the message and an HTML version, which refers to the
images with an <code class="docutils literal">img</code> tag that has an id that refers to the id in a
<code class="docutils literal"><span class="pre">Content-ID</span></code> <a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a> header in following parts of the multipart-related
<a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a> part that is the main body of the email.</p>
<p>I don’t know why Gmail doesn’t display the simpler <code class="docutils literal">multipart/mixed</code>
messages correctly.</p>
<p>It is very annoying. I don’t mind them using the
<code class="docutils literal">multipart/related</code> (which I didn’t even know about before looking
at one of their messages using <code class="docutils literal"><span class="pre">wl-summary-reedit</span></code> in <a class="reference external" href="https://www.emacswiki.org/emacs/WanderLust">Wanderlust</a>,
which pulls it up in the <code class="docutils literal"><span class="pre">mime-edit-mode</span></code> <a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a> composition mode
<a class="footnote-reference brackets" href="https://tkurtbond.github.io/posts/2020/12/11/mime-and-gmail-vs-other-mailers/#mime-edit-mode" id="footnote-reference-1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, which revealed all the details), but I wish they’d
get the simpler <code class="docutils literal">multipart/mixed</code> version right. Instead, they
don’t display the inline attachments (regardless of whether they are
images or text) and put them all at the end of the display as
attachments, and display the other text parts smushed together.</p>
<p>Interestingly, if a text part it has a <code class="docutils literal"><span class="pre">Content-Type:</span> Text/Plain</code>
<a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a> header field it is displayed inline in Gmail, unless it has a</p>
<div class="code"><pre class="code text"><a id="rest_code_473ea9e246bf45398c212e334ca957ef-1" name="rest_code_473ea9e246bf45398c212e334ca957ef-1" href="https://tkurtbond.github.io/posts/2020/12/11/mime-and-gmail-vs-other-mailers/#rest_code_473ea9e246bf45398c212e334ca957ef-1"></a>Content-Disposition: inline; filename="JRandomFilename.txt"
</pre></div>
<p><a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a> header field, and then it <strong>doesn’t</strong> display it inline,
unlike all the other mail readers I tried: <a class="reference external" href="https://www.emacswiki.org/emacs/WanderLust">Wanderlust</a>, <a class="reference external" href="http://www.mew.org/">Mew</a>, <a class="reference external" href="https://en.wikipedia.org/wiki/Alpine_(email_client)">Alpine</a>,
<a class="reference external" href="https://www.thunderbird.ne">Thunderbird</a> (had to have a pure GUI client for comparison), and <a class="reference external" href="http://www.mutt.org/">mutt</a>.</p>
<p>Interestingly, <a class="reference external" href="https://www.emacswiki.org/emacs/WanderLust">Wanderlust</a> displays Gmail’s <code class="docutils literal">multipart/related</code>
messages correctly, which impressed me.</p>
<p>I originally I thought that <a class="reference external" href="http://www.mew.org/">Mew</a> did not display the
<code class="docutils literal">multipart/related</code> message correctly, punting to just displaying
original <a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a>-encoded text instead, and not displaying the image
parts.</p>
<p>I was wrong about that; I was just confused by its presentation.
First it displays the text version of the enclosed
<code class="docutils literal">multipart/alternative</code>, which is what made me think it didn’t
display the image parts; it just hasn't yet! Then if I hit space, it
displays the first of the images, and then if I hit space it displays
the second of the images.</p>
<p>And you can make <a class="reference external" href="http://www.mew.org/">Mew</a> display the HTML part, but it doesn’t know how
the <code class="docutils literal"><img <span class="pre">id=“foo”></span></code> elements work, so it doesn’t display the
images.</p>
<p>I was pleased to see that the <a class="reference external" href="https://www.emacswiki.org/emacs/WanderLust">Wanderlust</a> (<a class="reference external" href="https://github.com/wanderlust/wanderlust">WGH</a>) and <a class="reference external" href="http://www.mew.org/">Mew</a> (<a class="reference external" href="https://github.com/kazu-yamamoto/Mew">MGH</a>) github
repositories both have recent commits.</p>
<p>And <a class="reference external" href="https://www.emacswiki.org/emacs/WanderLust">Wanderlust</a> and <a class="reference external" href="http://www.mew.org/">Mew</a> are both in <a class="reference external" href="https://melpa.org/">MELPA</a> these days, although
<a class="reference external" href="http://www.mew.org/">Mew</a>’s <a class="reference external" href="https://melpa.org/">MELPA</a> package doesn’t include the command line program,
<span class="command">incm</span>, that is used to pull emails from <span class="file">/var/mail</span>
into <a class="reference external" href="https://en.wikipedia.org/wiki/MH_Message_Handling_System">MH</a> style files under <span class="file">~/Mail</span>. <a class="reference external" href="https://www.emacswiki.org/emacs/WanderLust">Wanderlust</a> and <a class="reference external" href="http://www.mew.org/">Mew</a> both
use <a class="reference external" href="https://en.wikipedia.org/wiki/MH_Message_Handling_System">MH</a> style files under <span class="file">~/Mail</span> as their local message store.
<a class="reference external" href="https://en.wikipedia.org/wiki/MH_Message_Handling_System">MH</a> puts subdirectories there for folders, and in each folder the
messages are named with integers that correspond to the order in which
they were incorporated from whatever mail source you were using
(historically <span class="file">/var/mail</span>). <a class="reference external" href="https://en.wikipedia.org/wiki/MH_Message_Handling_System">MH</a> used command line programs to
incorporate mail, list mail messages, display mail messages, and file
it into folders. I rather liked it. I used <a class="reference external" href="https://www.nongnu.org/nmh/">nmh</a> (the New MH, a new
implementation of the original Rand MH commands, which ran on newer
Unixes) and <a class="reference external" href="https://mailutils.org/">GNU mailutils</a> (which provided MH-compatible command
line programs, if not configured out), sometimes during the same
period of time, for a considerable time. At one time, when I was
getting mail at a server I had online, I was using <a class="reference external" href="https://www.nongnu.org/nmh/">nmh</a>, <a class="reference external" href="https://mailutils.org/">GNU
mailutils</a>, Emacs’s built-in interface to MH (<a class="reference external" href="https://www.emacswiki.org/emacs/MH-E">MH-E</a>), <a class="reference external" href="https://www.emacswiki.org/emacs/WanderLust">Wanderlust</a>,
and <a class="reference external" href="http://www.mew.org/">Mew</a>. (Before that I used <a class="reference external" href="http://savannah.nongnu.org/projects/viewmail">ViewMail</a>, and before that I used
<a class="reference external" href="https://www.emacswiki.org/emacs/Rmail">RMAIL</a>) They each had features the other lacked.</p>
<p>I tried using <a class="reference external" href="https://www.seas.upenn.edu/~bcpierce/unison/">Unison</a> to sync that mail between my server online and
my computer at home, but that did not work well, since <a class="reference external" href="https://en.wikipedia.org/wiki/MH_Message_Handling_System">MH</a> commands
change the names of files when they move them from one folder to
another (remember, each message in a folder gets a name that is an
integer based on the order in which it was incorporated in that
folder, and its folder command provided an option, <code class="docutils literal"><span class="pre">-pack</span></code>, that
renamed all the messages in a folder sequentially, used after you’d
deleted messages) so you couldn’t keep track if the message named 32
in one folder on one machine was a new one or just renamed from 976
when you ran folder -pack last. Syncing with <a class="reference external" href="https://www.seas.upenn.edu/~bcpierce/unison/">Unison</a> just did not
work at all. Hmm. I could have changed the <code class="docutils literal">Path</code> option in my
<span class="file">.mh-profile`</span> file on each machine, so that instead of all the
<a class="reference external" href="https://en.wikipedia.org/wiki/MH_Message_Handling_System">MH</a> mail being under <span class="file">~/Mail</span> on both machines, on my home
machine it could have been under <span class="file">~/Mail-home</span> and on
tkb.mpl.com it could have been under <span class="file">~/Mail-onlineserver</span>, and
then I could have used <a class="reference external" href="https://rsync.samba.org/">rsync</a> to copy those from one machine to the
other appropriately so I’d have a backup. Huh. Wish I’d figured that
out back in the day. Of course, to read email in <span class="file">~/Mail-home</span>
on my online server I’d have had to changed the <code class="docutils literal">Path</code> option in my
<span class="file">~/.mh_profile</span> on that machine, and then changed it back when I
wanted to use <span class="file">~/Mail-onlineserver</span>. It would have worked,
however.</p>
<p>Completion made me go look at the <a class="reference external" href="https://en.wikipedia.org/wiki/MIME">MIME</a> messages I was testing in
<a class="reference external" href="https://www.emacswiki.org/emacs/MH-E">MH-E</a>. In the <code class="docutils literal">multipart/mixed</code> message <a class="reference external" href="https://www.emacswiki.org/emacs/MH-E">MH-E</a> does not show the
PNG files inline, though emacs has the capability to do that now. It
<em>does</em> have keybindings to open an external viewer for you. If you
specify the macOS command <span class="command">open</span> it will open it in whatever
app is the default for macOS; in the case of PNGs that is
<span class="app">Preview</span>.</p>
<p>I do most of my email reading and sending in Gmail these days, alas. I
still use <a class="reference external" href="https://www.emacswiki.org/emacs/WanderLust">Wanderlust</a> and <a class="reference external" href="http://www.mew.org/">Mew</a> occasionally, since they support <a class="reference external" href="https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol">IMAP</a>
very well. Now if only Google didn't make it harder to use them:
Gmail declares IMAP-over-SSL is a “less secure” application, and turns
<a class="reference external" href="https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol">IMAP</a> access off if you don't use it regularly.</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="mime-edit-mode" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="https://tkurtbond.github.io/posts/2020/12/11/mime-and-gmail-vs-other-mailers/#footnote-reference-1">1</a><span class="fn-bracket">]</span></span>
<p>This is provided by <a class="reference external" href="https://www.emacswiki.org/emacs/SemiIsEmacsMimeInterface">SEMI</a>, an Emacs Lisp package,
and it has a GitHub repo (<a class="reference external" href="https://github.com/wanderlust/semi">SEMIGH</a>), last commit 27 days ago as of
the time of this writing.</p>
</aside>
</aside>