How to intercept recipient before reply, and before sending?
P. Mazart
pmazart at web.de
Wed Jun 30 07:00:42 UTC 2021
Hi Jean,
we missed each other in IRC, so here’s my reply.
Jean Louis schrieb am 24.06.2021 15:36:10:
> Thus I would like to inject the ID number into the text before the
> reply.
I think you could always create a {python,bash,ruby} script or c-program
and let it “mimic” an editor when you reply:
:macro index r "<enter-command>set editor=\"edit-id-then-reply.py\"<enter><reply><enter-command>set editor=\"vim\"<enter>"
Once you hit your reply button »r« the editor is changed, started and
set back again. It could also start your favourite text editor.
e.g. you could use this as »edit-id-then-reply.py«:
#!/usr/bin/env python3
import sys
import subprocess
with open(sys.argv[1], 'a') as email_file:
email_file.write('Hello, I am your ID\n');
subprocess.run(['vim', sys.argv[1]]);
This would open the filename of the reply-email, then read it and change
some of its content (e.g. insert user id), then start your text editor so
you can type your reply.
> Is there a way to intercept the recipient's address, like making a
> macro for the `y' key binding?
Similar to the above, you could create a sendmail-compatible wrapper,
that does the interception and later actually runs sendmail or msmtp or
else.
Best Regards,
PM
More information about the Mutt-users
mailing list