Re: changing identity with different From:
On Fri, May 21, 2004 at 12:05:20AM +0200, Konstantin Kletschke wrote:
>I am searching for a way changing my identity on keypress.
>I figured out send-hook could do the thing but I would have to
>change my "From: " before initiating the process writing a mail
>pressing "m". Is that correct?
>
>At the moment before sending I change my "From: " header with
>macro compose 'F' "<edit-from><kill-line>me-<tab>"
>at the moment.
>
>But there are different headers to set also (Reply-To: for example)
>and the signature when I am "on business" for example.
>
>Is there a common sense way to do something like that?
Yes.
I do that this way:
I have several .muttrc files, each one with different signatures, From:
addresses, etc.
If I am in the index and I want to make sure I'm using the right
.muttrc, I use these commands:
macro index <f5> ":source ~/Mail/.specific.muttrc" "Some Label"
macro index <f6> ":source ~/Mail/.different.muttrc" "Other Label"
etc...
If I am in the compose screen I need to do it differently. Then I use
the same function keys (<F5>,<F6> etc...) to edit the headers thusly:
macro compose <f5> ":set editor='header_edit_f5'\n<edit-headers>:set
editor='vim'<enter>"
Watch the wrap there. I haven't found a good way to re-institute all of
my vim command-line switches because of the quoting, but I'm sure it's
doable. This sets a header-editing "editor" (code of which is coming),
performs the <edit-headers> command, calling the new editor, and then
puts things (approximately) back where I found them. Here's a sample of
the header_edit_f5 (you'll want several single purpose programs or to
send it parameters - I found it easier to write several programs (all
nearly identical)):
#!/usr/bin/perl -p -i
s/^From:.*$/From: William O'Higgins <mutt\@nerd.cx>/;
s/^Reply-To:.*$/Reply-To: William O'Higgins <mutt\@nerd.cx>/;
There are a metric scad of methods for this, but I am now happily
habituated to this one.
--
yours,
William
nerd.cx