Discussion:
Stop myself from sending an email with a particular string
Xu Wang
2018-09-15 03:18:09 UTC
Permalink
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"?

Long story long:
A friend of mine now openly identifies with male gender, and has
changed his legal name, and preferred name, to a new (male) name. The
problem is I've known this person since 5 years old, and it is being
so hard for me to begin calling them the new name. He is surely
patient and understanding of my repeated mistakes, so it is more my
frustration with me.

Kind regards,

Xu
Francesco Ariis
2018-09-15 03:30:32 UTC
Permalink
Hello Xu,
Post by Xu Wang
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

https://gitlab.com/muttmua/mutt/wikis/ConfigTricks/CheckAttach

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

Or, if you use a featureful editor to write your emails (e.g. vim), you
could highlight any specific word you like.

Would that help?
-F
Erik Christiansen
2018-09-15 06:16:28 UTC
Permalink
Post by Francesco Ariis
Hello Xu,
Post by Xu Wang
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
https://gitlab.com/muttmua/mutt/wikis/ConfigTricks/CheckAttach
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.
Post by Francesco Ariis
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.

Erik

¹ Having used it for well over half a decade, I find it invaluable.
Christian Brabandt
2018-09-15 09:09:20 UTC
Permalink
Post by Erik Christiansen
Post by Francesco Ariis
Hello Xu,
Post by Xu Wang
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
https://gitlab.com/muttmua/mutt/wikis/ConfigTricks/CheckAttach
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.
Yes that would be one possibility. But note, that starting from mutt 1.8
I believe, mutt now supports this natively using the abort_noattach
quadoption and abort_noattach_regexp option.

regards,
Christian
--
Canonical, adj.:
The usual or standard state or manner of something. A true story:
One Bob Sjoberg, new at the MIT AI Lab, expressed some annoyance at the use
of jargon. Over his loud objections, we made a point of using jargon as
much as possible in his presence, and eventually it began to sink in.
Finally, in one conversation, he used the word "canonical" in jargon-like
fashion without thinking.
Steele: "Aha! We've finally got you talking jargon too!"
Stallman: "What did he say?"
Steele: "He just used `canonical' in the canonical way."
Stefan Brandl
2018-09-15 15:33:32 UTC
Permalink
Post by Xu Wang
How can I have mutt refuse to send an email if the contents contain a
certain string, such as the example "Erica"?
The easiest way is to use vim as editor
and set

iab Erica John

in your .vimrc.
So everytime you type "Erica" in the editor
it will automagically replaced by "John".


Stefan
Xu Wang
2018-09-16 01:52:18 UTC
Permalink
Post by Xu Wang
How can I have mutt refuse to send an email if the contents contain a
certain string, such as the example "Erica"?
Thank you all so much for replies! I will explore options. Thank you
also for your kind sensitivity (I expected at least one person to make
a joke and am pleasant to be surprised that did not happen).

I highly appreciate your time and help.

Kind regards,

Xu

Continue reading on narkive:
Loading...