emailvimemail-attachmentsvim-pluginmutt

Prevent mutt sending email with missing attachments


While sending email with attachments I occasionally forget to attach the relevant files.

How do I setup mutt and vim to prompt me to attach missing files?


Solution

  • There's config option abort_noattach for mutt and neomutt to ask You about missing attachment before sending the message if message body matches regular expression set by abort_noattach_regexp. In neomutt the option is called abort_noattach_regex without the trailing p. But the mutt config variant should work also because it's a config synonym - see the code.

    You can find more about this in muttrc(5) or neomuttrc(5) manpages.

    Mutt

    3.1. abort_noattach
    Type: quadoption
    Default: no

    When the body of the message matches $abort_noattach_regexp and there are no attachments, this quadoption controls whether to abort sending the message.

    3.2. abort_noattach_regexp
    Type: regular expression
    Default: “attach”

    Specifies a regular expression to match against the body of the message, to determine if an attachment was mentioned but mistakenly forgotten. If it matches, $abort_noattach will be consulted to determine if message sending will be aborted.

    Like other regular expressions in Mutt, the search is case sensitive if the pattern contains at least one upper case letter, and case insensitive otherwise.

    Neomutt

    3.3. abort_noattach
    Type: quadoption
    Default: no

    If set to yes , when composing messages containing the regular expression specified by $abort_noattach_regex and no attachments are given, composition will be aborted. If set to no , composing messages as such will never be aborted.

    Example:

    set abort_noattach_regex = "\<attach(|ed|ments?)\>"

    3.4. abort_noattach_regex
    Type: regular expression
    Default: “ <(attach|attached|attachments?)> ”

    Specifies a regular expression to match against the body of the message, to determine if an attachment was mentioned but mistakenly forgotten. If it matches, $abort_noattach will be consulted to determine if message sending will be aborted.

    Like other regular expressions in NeoMutt, the search is case sensitive if the pattern contains at least one upper case letter, and case insensitive otherwise.