[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote on Wed, 07 Jun 2000:
> I would like to be able to use a different "from" address for some emails
> I send.

This is well supported under Mutt. :-)

> How would I configure mutt to select the correct from address based on a
> condition.  And what condition could I use?

The Mutt conditional commands are called hooks.  That is, in certain
situations Mutt looks for a/any matching hooks and executes them.

> I have set up a mailbox just for my work emails, could mutt detect that I'm
> viewing a work mailbox when I hit the "m" key, and set the from address to
> my work email address?
> 
> Or is there a better condition that could be checked, like the presence of
> my works domain name in the to or cc fields maybe?

Bingo!  One of the types of hooks Mutt has is send-hook, which is
used whenever you start a new email. (Despite the name it doesn't
run at the exact sending time, rather than when you create a new
email, either with m or a reply of some kind.)

The most basic kind of setup for switching between the two email
addresses is something like this:

  send-hook .                      "my_hdr From: You <[EMAIL PROTECTED]>"
  send-hook "~C @work.domain.com"  "my_hdr From: You <[EMAIL PROTECTED]>"


Order is important here.  The first hook is a so-called "default hook",
it gets executed every time.  The second hook is only executed if any of
the recipients have an email address with @work.domain.com in it.

The "~C @work.domain.com" is a conditional expression that checks
whether any of the recipients (To, Cc or Bcc) have @work.domain.com
addresses.  The command "my_hdr From: ..." sets up the From: header.


There is another way to do this, since you say that you've set up a
separate mailbox (mail folder, I guess) for your work emails.  Mutt also
has folder-hooks that get executed at folder-change time.  You could set
up folder-hooks like the above, that change your From: address depending
on which mail folder you are in.

However I'd personally prefer doing the selection based on the recipient
address, not which folder I'm in.


For more information, read the manual. :-)


Hope this helps,
Mikko
-- 
// Mikko Hänninen, aka. Wizzu  //  [EMAIL PROTECTED]  //  http://www.iki.fi/wiz/
// The Corrs list maintainer  //   net.freak  //   DALnet IRC operator /
// Interests: roleplaying, Linux, the Net, fantasy & scifi, the Corrs /
When everything's coming your way, you're in the wrong lane.

Reply via email to