On 2017-04-26, Grant Edwards <grant.b.edwa...@gmail.com> wrote:
> On 2017-04-26, Will Yardley <mutt-us...@veggiechinese.net> wrote:
[...]
>>> > > Is there anything one can do when sending a plain text e-mail message
>>> > > to tell GUI-based MUAs that they should display it in a fixed font?
[...]
>> Send in HTML with the <pre> tag? /ducks

Well, that's actually what I do now.  ;)

> If there was a simple way to get mutt to auto-magically do that to
> create a multipart/alternative text and HTML message body, that
> wouldn't be that bad an option.  Though I'd probably use <xmp> rather
> than <pre>, since <xmp> is less fragile.
>
> I also wouldn't be too averse to setting up some sort of scheme for
> running a message body thought asciidoc or rst to produce HTML and
> plaintext multipart alternative.

The solution I settled (and have been using for a couple weeks now) is
to use mutt's 'sendmail' configuration setting to pipe outgoing mail
to the 'muttdown' utility which will look for text-plain parts and add
an alterntive html version by formatting them with markdown (if the
body part begins with !m) or escape them and enclose them in a
<pre></pre> tag (if the body part begins with !p).  I tried using
<xmp></xmp>, but Gmail doesn't support it.

If a text-plain body part doesn't begin with either !m or !p, then it
is sent untouched.

The sources for my enhanced version of muttdown are here:

  https://github.com/GrantEdwards/muttdown/tree/work

My enhancements over the original muttdown are:

 * Fix bug in handling or exit code from external sendmail.

 * Load user-configurable muttdown extensions.

 * Add !p sigil which encloses everything in <pre></pre>

 * Only remove the first !p or !m sigil before converting to HTML.

 * Add option to remove sigil from plaintext alternate.

 * Make "-c" optional.

 * Restructure code so you can run main.py directly without doing an a
   "python setup.py install".

 * Add <body></body> tags around the whole message to enable 'global'
   CSS settings that you want to apply to everything.

One thing I'd still like to do is to add NTLM auth support to the SMTP
client code that's built in to muttdown.  Currently, I have to
configure muttdown to pipe the outgoing mail to msmtp (which knows how
to do NTLM auth).

It would be a lot cleaner if mutt provided some sort of
sendmail-filter-hook that would allow you to specify an external
command that could be use as a filter on the outgoing message (headers
and all) just before it is sent...

-- 
Grant Edwards               grant.b.edwards        Yow! Are you mentally here
                                  at               at Pizza Hut??
                              gmail.com            

Reply via email to