* Michael Elkins on Saturday, April 17, 2010 at 17:38:15 -0700 > On Sat, Apr 17, 2010 at 01:47:36PM -0400, Asif Iqbal wrote: >> Our company policy is to forward the spam as an attachment to company >> abuse address. >> >> So, I am doing all the following 6 steps to do just that >> >> f <hit this in index to forward> >> To: <type the abuse address at this prompt> >> Subject: the long message <hit enter to accept as it is> >> Forward as attachment? <type yes> >> <type :wq exit vim editor> > > It's not possible to make Mutt control your editor in this way. > >> <hit y to send it> >> >> Is it possible to bind all these steps to one key like for example `S' >> in index ? > > I can think of two possible solutions: > > 1) have Mutt save the message to a temporary file and then invoke > itself to mail the file: > > my_tf=/tmp/spam-message > macro index S '\ > <copy-message>$my_tf<enter>\ > <shell-command>mutt -a $my_tf -- ab...@some.domain < /dev/null<enter>' > > 2) temporarily change your $editor to /bin/true to bypass editing > the file since you want to automate it > > macro index S '<enter-command>my_abort_unmodified=$abort_unmodified;\ > my_editor=$editor;\ > my_mime_forward=$mime_forward;\ > set editor=/bin/true abort_unmodified=false<enter> mime_forward=yes<enter>\ > <forward-message>\ > ab...@some.domain<enter>\ > <enter>\ > <send-message>\ > <enter-command>set abort_unmodified=$my_abort_unmodified\ > editor=$my_editor mime_forward=$my_mime_forward<enter>' > > Completely untested, but that's the idea at any rate.
I tried the editor=true way; it works in principle, unless one has a send-hook that tweaks e.g. $editor. Then it gets really hairy because after unhook'ing one would have to reinstate the hook(s) ... c -- theatre - books - texts - movies Black Trash Productions at home: http://www.blacktrash.org/ Black Trash Productions on Facebook: http://www.facebook.com/blacktrashproductions