Wolfgang Bornath wrote on Wed, Jul 31, 2002 at 05:12:31PM +0200 :
> I'm using Mutt as mail client and get the transferring done with
> postfix/fetchmail.

Good man.

> I'd like to send mails to different addreses using different sender
> addresses. OK, I can alwaays edit the From: field each time I send a
> mail. But isn't there a way to organize this, like:

Yes there is.  Finally an easy question.

> mail to expert list --> use [EMAIL PROTECTED]
> mail to the mandrake ppl --> use [EMAIL PROTECTED]
> mail to some other addresses --> use [EMAIL PROTECTED]
> mail to some other addresses --> use another one of my 5 mailtos.
> There must be a way in Mutt, but will it be altered by postfix? And, of
> course, I don't want to login as a different user just to accomplish
> this.

No need to login as a different user.  What you want to use are "hooks".
You configure your hook to analyze some identifiable section of the
email you are sending and change the from address based on what it
finds.  Here's a real live sample from my house:

send-hook . set pgp_autosign
send-hook . 'my_hdr From: Todd Lyons <[EMAIL PROTECTED]>'
send-hook '~t ^.*@mandrakesoft\.com' 'my_hdr From: Todd Lyons 
<[EMAIL PROTECTED]>'
send-hook '~t ^majordomo\@.*' unset pgp_autosign
send-hook '~t ^california\-volleyball\-south\@.*' unset pgp_autosign

The first two lines set the defaults (consider the . to be equal to
"default" when it comes to hooks).  The third line looks in the to or cc
line for "@mandrakesoft.com".  If it finds it, it changes the From
address to my work email address.  The fourth line unsets pgp signing if
I'm sending an email to majordomo (though it really doesn't matter in
the real world).  The fifth line unsets pgp signing if the email to
contains "california-volleyball-south@".  Note the use of ^ for
beginning of object, the .* for matching any number of characters, and
escaping periods.  Also note the use of single quotes around the macro
and regex.

Explanation:  the ~t is the macro.  It means "In the To: or CC:".  The
regex is a regular expression just like you would use in perl or sed or
awk.  For more info on the macros, look in section 4.2 of
/usr/share/doc/mutt*/manual.txt.  

Blue skies...           Todd
-- 
  Todd Lyons -- MandrakeSoft, Inc.   http://www.mandrakesoft.com/
UNIX was not designed to stop you from doing stupid things, because 
  that would also stop you from doing clever things. -- Doug Gwyn
   Cooker Version mandrake-release-9.0-0.2mdk Kernel 2.4.18-21mdk

Attachment: msg56699/pgp00000.pgp
Description: PGP signature

Reply via email to