12
3
I'd like the option for certain emails and/or recipients to have a script run before sending (whether automatically or by pressing a keybinding) which takes my text/plain
, runs a script over it, and then attaches the output of that script with the text/html
type, setting the whole message to multipart/alternative
.
Side ramble: It might be nice if this happened automatically immediately before sending but only if the body type was currently set to text/markdown
, as this would mean the pending email is never in a state where I edit the source again but forget to regenerate the HTML, and I still have the option to send only text/plain
. Then I'd have another binding to set the content type of the body to text/markdown
, so that this would be picked up. But then I also have the issue that a lot of mail clients (Gmail included) refuse to render text/markdown
(even as plain text), instead offering it as a download, so I'd need to have the content type of the source part switched back to text/plain
.
Is such a thing possible with mutt?
Sadly as far as I can tell mutt doesn't support sending multipart/alternative
messages, refusing to send anything but multipart/mixed
, but I'd love to be shown I'm wrong.
The best solution I've been able to come up with is this macro:
macro compose M "<filter-entry>commonmark<return>y<edit-type><kill-line>text/html<return>" "convert message to HTML with Commonmark"
There are a few issues with this:
- It entirely replaces the original plain text, so it's then much harder to edit
- I don't like that there's the
y
in the macro to say yes to the dialog asking whether it's okay to overwrite the file - I have to press return after this runs
- And of course the main thing: it doesn't send the plain text alternative
Is there a better solution?
I'm potentially open to another text-mode mail client, as long as it
- is usable with Google Apps, and syncs flags etc in both directions
- supports GPG
- has vim-like bindings, or I can configure them
- lets me use vim as a message editor
- has a threaded message view
- allows me to filter/search mail in a somewhat sophisticated way (sender, recipient, presence of attachments, subject and body text search)
- handles attachment types a bit like mutt, i.e. mailcap or equivalent so I can run incoming HTML mail through lynx, or press something to open it in the graphical browser if need be, I can launch image viewers at a button press, and so on
That is good to hear. The page you linked said the support for sending multipart/alternative is rudimentary but I'll give it a try some time soon. Thanks for pointing it out. – tremby – 2019-04-04T23:28:30.873
Neomutt is supposed to be a drop-in replacement for regular ol' mutt. The other nice thing is that its apparently got pretty large active development. – Davey – 2019-04-05T12:17:06.910
Looks like the feature was added just a year ago: https://github.com/neomutt/neomutt/pull/734
– tremby – 2019-04-05T18:30:14.367It works great. I made a macro similar to the one suggested in the docs you posted at https://neomutt.org/guide/mimesupport#5-2-%C2%A0composing-multipart-alternative-emails -- I still have to press enter after using the macro, and I'm not yet sure what will happen if I want to make changes after generating the alternative but before sending, but I'll figure all that out in due course. Note the first version to support multipart/alternative is the 2018-05-12 release, which is not yet in my distro. I compiled from source with
– tremby – 2019-04-05T23:27:38.533--gnutls --prefix/usr/local --tokyocabinet
.