Hello,

I'm answering two emails together since the questions were so similar.


Jean-Sebastien Morisset <[EMAIL PROTECTED]> wrote on Thu, 23 Mar 2000:
> I've seen this done on other mail readers, but I'm not sure if mutt can do
> it. I'd like to send mail from different addresses. Maybe mutt could ask
> me which "From:" to use before heading into the editor. And if a list
> could be displayed of the "From:" addresses I use, that would be even
> better.
> 
> Can I do something close to this with Mutt?

You can't get it done interactively by using *only* Mutt functionality.

However there are two main methods to select your From: address
automatically.  The first and more common one (I think) is to use
send-hooks to set the From: address based on the recipient address.

For example:

  send-hook .         source ~/.mutt/profile-default
  send-hook .*dna\.fi source ~/.mutt/profile-dna

This will source the file ~/.mutt/profile-dna for all the emails that
I sent that have someone from the dna.fi domain as recipient.  This
file sets up my From: header appropriately.  For Mutt 1.0.x, the command
is:

  my_hdr From: "Mikko Hänninen" <[EMAIL PROTECTED]>

For Mutt 1.1.x:

  set realname="Mikko Hänninen"
  set [EMAIL PROTECTED]

The file can contain other configuration directives too, such as setting
a special signature:

  set signature=~/.dna-sig

You can also put these commands directly in the send-hook commands, but
I prefer to use separate files which get sourced, so that I only need to
have one hook and can have multiple commands in the files.  They get
grouped together and so editing them is easier too.


The other method is to use $reverse_name.  When this Mutt variable is
set and you start a reply, if Mutt recognises the address in the To:
header as belonging to you (hint: you need to set your $alternates
correctly), then it will use that address as the From: address in your
reply.


There is a third method, but this is not automatic and not so nice
because of that: Setting up keyboard macro keys (for example, F2, F3,
F4...) to load settings which generate a desired profile.  Eg.

  macro index <f2> source ~/.mutt-profile-1
  macro index <f3> source ~/.mutt-profile-2
  macro index <f4> source ~/.mutt-profile-3

... and then you'd putt the commands (my_hdr From:, or set from= )
in those files, along with setting signatures and such.


Martti Rahkila <[EMAIL PROTECTED]> wrote on Thu, 23 Mar 2000:
> I'm a newcomer to the list, so my apologies, if this issue has already
> been dealt with (several times...)

It has, more or less, although it's a bit of a complex issue so
understanding how to do this just based on the manual is not necessarily
easy.

Also there is no entry for this in the FAQ...  Someone should write one.
:-)  Or perhaps more like a Mini-HOWTO...


> My question is: Can mutt be configured to have sender profiles?

The short answer to this is yes.


> The features that I'd like to
> automate with these profiles are From, Reply-To, Fcc, PGP sign-key, 
> reply-format and signature.
> 
> I know that with send-hook I can define at least some of these but only
> for certain addresses and that I can also switch to another pgp sign-key 
> by pressing P, choosing a (for sign (a)s) and giving a new key id. 
> But what I would want to have is to be able to choose a profile between 
> To: and Cc: when sending mail.
> 
> Is something like this possible with mutt and if it is, what would be
> the magical configuration?

I don't use PGP so I don't know whether setting the sign-key is possible
from a Mutt command, but I'm guessing it is (if not else, you can always
use push...).  Everything else I know is configurable from scripts.

There is no way to set up an interactive selection list within Mutt, so
whatever you want to do needs to be done either with automatic commands
(send-hooks, $reverse_name) or macros.  A macro could presumably call an
external program that gives a list of choices and then writes a
.muttrc-style file which is then sourced by the macro after the command
has executed.  This has the drawback that you can't combine with this
with send-hooks, since the hook settings (especially if you have a
default hook, which is usually needed) will overwrite the settings
loaded from the file.

Mutt send-hooks are really rather versatile, so whatever setup you want
to do is probably possible with them though.  Either them alone, or with
$reverse_name.


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 /
Contentsofsignaturemaysettleduringshipping.

Reply via email to