Chris,

Here's what I do:

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
set my_realname='Todd\ Hesla'

# This account.
#
  set my_this_domain=this.com
  set my_this_un=this_un
  set my_this_pw=`gpg2 -d --batch  ~/.mutt/.this_pw.gpg`
  set my_this_server=imaps://$my_this...@imap.this.com:993
  set my_this_smtp_server=smtp://$my_this...@smtp.this.com:587
  set my_this_inbox=$my_this_server/INBOX

  account-hook $my_this_server set imap_pass=$my_this_pw

  account-hook $my_this_smtp_server set smtp_pass=$my_this_pw
  account-hook $my_this_smtp_server set ssl_min_dh_prime_bits=512

  folder-hook $my_this_server set smtp_url=$my_this_smtp_server
  folder-hook $my_this_server \
    alias me   $my_realname <$my_this_un@$my_this_domain>
  folder-hook $my_this_server \
    alias todd $my_realname <$my_this_un@$my_this_domain>
  folder-hook $my_this_server set folder=$my_this_server
  folder-hook $my_this_server set hostname=$my_this_domain
  folder-hook $my_this_server set from=$my_this_un@$my_this_domain
  folder-hook $my_this_server set realname=$my_realname

  mailboxes $my_this_server

# That account.
#
  set my_that_domain=that.com
  set my_that_un=that_un
  set my_that_pw=`gpg2 -d --batch  ~/.mutt/.that_pw.gpg`
  set my_that_server=imaps://$my_that...@imap.that.com:993
  set my_that_smtp_server=smtp://$my_that...@smtp.that.com:587
  set my_that_inbox=$my_that_server/INBOX

  account-hook $my_that_server set imap_pass=$my_that_pw

  account-hook $my_that_smtp_server set smtp_pass=$my_that_pw
  account-hook $my_that_smtp_server set ssl_min_dh_prime_bits=512

  folder-hook $my_that_server set smtp_url=$my_that_smtp_server
  folder-hook $my_that_server \
    alias me   $my_realname <$my_that_un@$my_that_domain>
  folder-hook $my_that_server \
    alias todd $my_realname <$my_that_un@$my_that_domain>
  folder-hook $my_that_server set folder=$my_that_server
  folder-hook $my_that_server set hostname=$my_that_domain
  folder-hook $my_that_server set from=$my_that_un@$my_that_domain
  folder-hook $my_that_server set realname=$my_realname

  mailboxes $my_that_server

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-- 
Todd Hesla



On Fri, Nov 09, 2012 at 04:00:05PM +0000, Chris Green wrote:

> Date: Fri, 9 Nov 2012 16:00:05 +0000
> To: mutt-users@mutt.org
> From: Chris Green <c...@isbd.net>
> Subject: How to change From: according to hostname?
> 
> I want to use identical muttrc files on two different hosts (I'll be
> using rsync to keep them in step), however I want my From address to be
> set differently for the two hosts.
> 
> How can I switch the From address according to the hostname?  It won't
> *use* the host name in the From address, I just want to be able to
> detect the host name and set the From address accordingly.  I need a
> sort of send-hook with pattern matching on an external (host name)
> parameter. 
> 
> Specifically I want (using existing send-hook syntax):-
> 
>     On host zbmc.eu:- 'my_hdr From: Chris Green <ch...@isbd.co.uk>'
> 
>     and on host cheddar.halon.org.uk:- 'my_hdr From: Chris Green 
> <ch...@halon.org.uk>'
> 
> -- 
> Chris Green

Reply via email to