Re: Using send and reply hooks to set from address and reverse_name

2013-05-11 Thread James Griffin
Thu  2.May'13 at 10:30:00 +0200, Suvayu Ali
> Hi Mutt users,
 
> Now my problem is the default reply-hook above overrides the from
> address set by reverse_name=yes.  If I comment it out, then the from
> address is what was set by the last "my_hdr From: ..." command in the
> above hooks.  I want it to be my personal address.
> 
> Any ideas how to resolve this conflict between hooks and reverse_name?


My muttrc settings for default from address:

set from=m...@myadress.com
set reverse_name=yes
set use_envelope_from=yes

My default folder-hook to remove hooks set having visited other folders:

folder-hook .'\
...
send-hook . unmy_hdr From: ;\
send-hook . unmy_hdr Reply-To: \
'

A hook for my main spoolfile - sets various "things" when using my Gmail 
address:

folder-hook '!' 
...
 send-hook "~f mygmailusern...@gmail.com" "my_hdr Reply-To: 
mygmailusern...@gmail.com; ... " ;\
 ... \
 ,


A hook for my Gmail folder/account:

folder-hook +gmail '\
...
my_hdr From: mygmailusern...@gmail.com ;\
my_hdr Reply-To: mygmailusern...@gmail.com ;\
... \
'

A mailing list example, omitting other commands:

folder-hook +mutt '\
...
send-hook "!~l !~p" "my_hdr From: mygmailusern...@gmail.com; my_hdr 
Reply-To: mygmailusern...@gmail.com" ;\
... \
'

ensure all $alternates are set up correctly. And $subscribe addresses.

This works for me, it may be of some use? The main setting is to have a
default hook (folder-hook) that undoes the hooks you have set in other
folder-hooks.

-- 
James Griffin: jmz at kontrol.kode5.net 
   jmzgriffin at gmail.com

A4B9 E875 A18C 6E11 F46D  B788 BEE6 1251 1D31 DC38


Re: Using send and reply hooks to set from address and reverse_name

2013-05-11 Thread Andre Klärner
Hi Suvayu,

On Sat, May 11, 2013 at 02:08:34AM +0200, Suvayu Ali wrote:
> On Tue, May 07, 2013 at 08:28:46PM +0200, Andre Klärner wrote:
> > 
> > small question: why don't you use "set from=wor...@domain.com" etc?
> 
> As far as I'm aware, 'set from=..' and 'my_hdr From ..' serves the same
> purpose.

As already pointed out by Patrick: they are not exactly the same.

> > I have the setup as following:
> > each mail is filed to a matching folder, my personal mail go to ~/Maildir,
> > my work email are accessed via imap://work-server/…, some of the other
> > accounts follow the same pattern.
> 
> I do not use IMAP directly.  I use OfflineIMAP to sync to a maildir in
> my home directory.  I also use one SMTP (gmail) with different from
> addresses to reply to my emails from different accounts.  Gmail lets you
> do this once you have authenticated that these alternate from addresses
> are indeed yours.

Well, the folder-hook doesn't act upon the protocol, but on the "name" of
the folder - so you are free to use whatever you like, as long as you can
build the regex for matching that folder.

> > Depending on the folder I'm in the correct from address is set with "set 
> > from=…"
> > As each IMAP account use different SMTP-Servers these are set via some
> > send-hooks that depend on the from: address. This also matches my workflow
> > that new mails are edited/sent using a second mutt-instance in a new
> > screen-window.
> >
> > Maybe this gives you an idea how to accomplish your setup.
> 
> The idea about using another screen window sounds intriguing.  I'll play
> with this.

I also just stole this;)

> > If someone wants to read it I can post my current mutt-setup tomorrow.
> 
> That might help actually.  Of course only if it is not too much trouble :).

You can check it out at http://git.ak-online.be/kandre/mutt/tree
But it might take me a while to merge back my a bit more complex grown
setup at work, didn't have the chance to properly build the "one config to
rule them all" version. But as I have nightshift today I might get to it
tonight.

Regards, Andre

-- 
Andre Klärner


smime.p7s
Description: S/MIME cryptographic signature