Stop myself from sending an email with a particular string

Erik Christiansen dvalin at
Sat Sep 15 06:16:28 UTC 2018

On 15.09.18 05:30, Francesco Ariis wrote:
> Hello Xu,
> On Fri, Sep 14, 2018 at 11:18:09PM -0400, Xu Wang wrote:
> > Long story short:
> > How can I have mutt refuse to send an email if the contents contain a
> > certain string, such as the example "Erica"?
> There is a script that implements a similar functionality

If you compose emails in Vim, then simpler yet, Christian Brabandt's
long established¹ CheckAttach plugin checks for default keywords, and
the user can configure new ones in the g:attach_check_keywords variable.
OK, it will then prompt for attachments on an exit attempt, but _also_
highlight the triggering keywords - in this case "Erica". The attachment
process, spurious for this use-case, is aborted by hitting <enter>, so
the plugin adaptation is a quick and simple way to achieve the desired
watchdog function.

> The trick is simple: substitute $sendmail with a custom one.

Sounds more complex than a simple plugin install plus a Vim variable
setting, especially given the X dependencies and consequential
workarounds for terminal. 


¹ Having used it for well over half a decade, I find it invaluable.

More information about the Mutt-users mailing list