On Thu, Apr 15, 2010 at 05:23:13PM +0100, 'Mash wrote:
set from="Name <n...@domain.com>"
alternates "customerserv...@domain.com"
set reverse_name=yes
send-hook '~f customerserv...@domain.com' 'my_hdr Cc: ot...@domain.com'

1. start mutt
2. hit "r" to reply to an email that has been sent to 
"customerserv...@domain.com"
3. edit message, save, exit editor
4. "reverse_name" worked "From: customerserv...@domain.com" is set but "Cc:" is 
empty
5. hit "q" and do not send message
6. hit "r" on the very same message as before
7. edit message, save, exit editor
8. "reverse_name" worked "From: customerserv...@domain.com" is set and "my_hdr" worked! 
"Cc: customerserv...@domain.com"
9. hit "r" or "g" on any further messages and all messages get the "my_hdr" 
change.

No really I have tested this 20 times now, hit reply once and it wont work. Hit reply on the same 
message again and for all further messages mutt starts to use the "send-hook". It's like 
you have to kick mutt into action first. Strange?! You only have to do this double reply once and 
all further replies appear to use the "send-hook" correctly.

Yes, this is how hooks in Mutt work. If you change a setting in a hook, it is not changed back to its original state once the operation has completed. This is why you often see hooks of the form:

        send2-hook . unset pgp_autosign
        send2-hook '~C "(debian|fedora|mutt)"' set pgp_autosign

The first hook with the pattern "." is the default action to take. The second one matches just the case you want. If you don't use the first hook, then the effect of the second hook will still be in effect the next message you send.

BUT this setup will not work...

set from="Name <n...@domain.com>"
alternates "customerserv...@domain.com"
set reverse_name=yes
send-hook '~f customerserv...@domain.com' 'my_hdr Cc: 
customerserv...@domain.com'

If you set the "my_hdr" to set the "Cc:" to the same address as your "From:" it will NOT accept the 
change no matter how many times you try, "Cc:" will always be empty. I have tested this many times now and can 
replicate it. Every string but what is exactly the same as your "From:" is allowed. Strange but true.

Yes, Mutt does not determine how to set the From: line until *after* the send-hook is executed. This is due to the fact that one of the primary use cases for the send-hook is to change the From: line based upon whom you are sending mail. So your ~f pattern never matches as expected. Even if it did, like I explained in my previous email, you can't currently edit the recipients list in this manner.

The reason for me wanting to do this is that I work with another colleague and all emails sent to "customerserv...@domain.com" 
get sent to both of us. What I wanted to happen is that though my primary address is "n...@domain.com"; when emails get sent to 
"customerserv...@domain.com" and I reply, I want "reverse_name" to correctly change my "From: 
customerserv...@domain.com" but also set "Cc: customerserv...@domain.com" so that my colleague can see my reply.

This is working 90%, though like I showed you have to kick start mutt to use the 
"send-hook".
Is there something that I can set to allow an email to have the same address in "From:" 
and "Cc:" is this actually something mutt disallows somehow to avoid loops?

The problem with what you are currently doing is that *every* message, even those not addressed to customerserv...@domain.com will be Cc'd after the first time you reply to an email addressed to it, because your send-hook is not undone after the mail is sent.

I think what you can do to get the effect you desire is to use 'set metoo' so that when you group-reply to a message, customerserv...@domain.com will not be removed from the Cc line.

me

Attachment: pgpQ8IpJWmmLh.pgp
Description: PGP signature

Reply via email to