<<< Date Index >>>     <<< Thread Index >>>

Re: make mutt prompt for from address



On 2006-09-06, James Miller <jamtata@xxxxxxxxx> wrote:
> One Pine feature I haven't yet figured out how to
> implement in mutt has to do with the address that
> appears in the from field. In Pine. I had the program
> configured to ask each time I sent an e-mail what from
> address to use. It was a bit annoying to have to go
> through the extra step of selecting one (selection
> from a menu--typing it out fully each time wouldn't be
> workable), but it proved to provide a good check that
> I was sending from the correct address each time. I've
> set up aliases under mutt using a macro I found so
> that, by hitting the escape key and typing a few
> letter I can have the from field filled in with the
> address I want. But I'd really like to be able to get
> mutt to prompt me each time I compose an e-mail for a
> from address, and hopefully have a way to supply that
> address without having to fill it in in full. I
> haven't managed yet, despite perusal of the manual and
> some web searching, to understand how I might do this.
> Might someone on this list give me some pointers on
> this?

How about something like this:

    :macro index m ':my_hdr From: `$HOME/bin/fromsel`<return><mail>'

where $HOME/bin/fromsel contains:

    exec < /dev/tty
    stty_save=$(stty -g)
    stty sane
    select name in me1@here1 me2@here2 me3@here3
    do
        echo $name
        break
    done
    stty $stty_save

When you type 'm' to compose a message, you will first be presented 
with a menu of From addresses.  Type the number of the address you 
want and hit Enter.  Message generation will then proceed normally 
but with the From address you selected.

I hacked on the 'fromsel' script until the terminal behaved nicely 
and then left it alone.  I'm not sure all the /dev/tty and stty 
stuff in there now is necessary and there might be better ways of 
handling the terminal settings.

HTH,
Gary

-- 
Gary Johnson                               | Agilent Technologies
garyjohn@xxxxxxxxxxxxxxx                   | Wireless Division
http://www.spocom.com/users/gjohnson/mutt/ | Spokane, Washington, USA