Friday, August 3, 2018

vim - Interactively send email with empty message body in Mutt


I use Mutt as my email client with Vim configured as my editor. Every now and again, I want to send an email (usually to myself) that has an empty message body, e.g., the message has a Subject line and an attachment.


When composing such an email, I enter a subject line and recipient address and then Vim opens to allow me to edit the message body. I have to enter some whitespace before saving and closing the temporary file. If I simply quit Vim without entering any text (using the :q or :x commands), I get the following error message and am returned to the mailbox folder index.



Aborted unmodified message.



I’m aware that I can use the command line to send such a message:


 echo | mutt -s "Subject Line" -a attachment.zip anthony@example.com

However, I’d like to be able to do this while using Mutt interactively. Is there a configuration variable that can be set to allow empty message bodies?


I looked through the documentation on the Mutt website and used both DuckDuckGo and Google to search for the phrase “Aborted unmodified message” but all the results seem to be related to users who did not have their editor variable set correctly.


Answer



Mutt notes the modification time of the temporary message body file before starting Vim, then checks it again after Vim exits. If the modification time is unchanged, Mutt doesn't send the email message and issues Aborted unmodified message.


An easy way to avoid that is to simply write the empty buffer with :w before closing Vim.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...