send-hook persistence (Was: Re: different from addresses based on recipients)
Making progress. These settings: set reverse_name # if it's To: or CC: *stuff.com or originating from the stuff folder, # be From: [EMAIL PROTECTED] and add a sig # if it's not From: [EMAIL PROTECTED], nuke the sig and go back to normal From: folder-hook =stuff 'set signature=~/.sig' folder-hook =stuff 'my_hdr From: Troy Davis <[EMAIL PROTECTED]>' send-hook '~C stuff\.com' 'my_hdr From: Troy Davis <[EMAIL PROTECTED]>' send-hook '!~f troy@stuff\.com' 'my_hdr From: Troy Davis <[EMAIL PROTECTED]>' send-hook '~f troy@stuff\.com' 'set signature="~/.sig"' send-hook '!~f troy@stuff\.com' 'set signature=""' works nicely when replying to messages that were sent to [EMAIL PROTECTED] At least, until I reply to a message that was sent to to [EMAIL PROTECTED] Then it won't use [EMAIL PROTECTED] for the rest of the mutt session. It does still evaluate the signature settings correctly though. Suggestions? FYI, if anyone cares, I was unable to make a hook 'unset signature' or 'set hostname="stuff.com"'. Feature limitation or user error I don't know, but the same hook worked triggered fine if I was doing 'set signature="~/.sig"' or 'set realname="Me"'. 'set signature=""' also worked. Cheers, Troy
Re: different from addresses based on recipients
On Sat, 02 Oct 1999, Mikko Hänninen <[EMAIL PROTECTED]> wrote: > 1) If in the folder "stuff", or if sending email to any @stuff.com > address, use > - a From header of "From: Troy Davis <[EMAIL PROTECTED]>" > - a signature ~/.sig > > 2) Otherwise, use > - a From header with reverse_name (the address that the email was sent to) > - no signature Yep. > folder-hook . 'send-hook . "source default-settings"' > folder-hook =stuff 'send-hook . "source stuff-settings"' > send-hook "~t @stuff\.com" 'source stuff-settings' > set reverse_name > > > in file default-settings: > unmy_hdr From > unset signature > > in file stuff-settings: > my_hdr From: Troy Davis <[EMAIL PROTECTED]> > set signature=~/.sig Using that has the following behavior: - The ~t @stuff\.com hook is never executed, ie, even mail to [EMAIL PROTECTED] goes through as the default address, not [EMAIL PROTECTED] - When I change to the stuff folder, mail goes out as [EMAIL PROTECTED], but never changes back to [EMAIL PROTECTED] when I move to other folders. Cheers, Troy
Re: different from addresses based on recipients
Troy Davis <[EMAIL PROTECTED]> wrote: > > Is there a way to change the From: address based on a message's recipient (ie, > based on what it gets when it prompts for To: and Subject:)? > > I played with send-hook with no luck. That's strange, because send-hook is exactly what you would use to accomplish this. Perhaps you could post what you tried to do. -- David DeSimone | "The doctrine of human equality reposes on this: [EMAIL PROTECTED] | that there is no man really clever who has not Hewlett-Packard | found that he is stupid." -- Gilbert K. Chesterson UX WTEC Engineer |PGP: 5B 47 34 9F 3B 9A B0 0D AB A6 15 F1 BB BE 8C 44
Re: different from addresses based on recipients
Troy Davis <[EMAIL PROTECTED]> wrote on Fri, 01 Oct 1999: > 1. In the folder "stuff", use the signature file ~/.sig and the address > [EMAIL PROTECTED] > otherwise, use the default From: address and no sig > > 2. On any new message or replies to *@stuff.com, use the address > [EMAIL PROTECTED] > otherwise, default From: address > > 3. On any new message or replies From: [EMAIL PROTECTED], use the signature file > ~/.sig > otherwise, no sig > > 4. Reply to *all* messages with the realname set to Troy Davis but using the > address that the message was sent to if it's one of my alternates -- a > halfbaked reverse_name. Hmmm, ok, so you want basically 2 different behaviours: 1) If in the folder "stuff", or if sending email to any @stuff.com address, use - a From header of "From: Troy Davis <[EMAIL PROTECTED]>" - a signature ~/.sig 2) Otherwise, use - a From header with reverse_name (the address that the email was sent to) - no signature So let's see... folder-hook . 'send-hook . "source default-settings"' folder-hook =stuff 'send-hook . "source stuff-settings"' send-hook "~t @stuff\.com" 'source stuff-settings' set reverse_name in file default-settings: unmy_hdr From unset signature in file stuff-settings: my_hdr From: Troy Davis <[EMAIL PROTECTED]> set signature=~/.sig All of the above is untested, but I hope it works. :-) You might be able to get away without using 2 extra rc files, but I think it makes things clearer. I would advise against playing with hostname and rather to create the From header that you want yourself with my_hdr. 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 / Inertia makes the world go round.
Re: different from addresses based on recipients
On Fri, 01 Oct 1999, David DeSimone <[EMAIL PROTECTED]> wrote: > That's strange, because send-hook is exactly what you would use to > accomplish this. That's what I thought as well, but it seemed like the send hook was being executed when the message was being sent, after the headers had been generated. The change in From: addresses was reflected on the next message I composed, but not the one that I'd composed that met the To: rule. > Perhaps you could post what you tried to do. I did on 9/28, with the subject "recipient-based hooks". It's inserted below. Specifically #3, but advice on any question would be appreciated. - Date: Tue, 28 Sep 1999 19:56:50 -0700 From: Troy Davis <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: recipient-based hooks Greetings, I'm trying to achieve the following 4 behaviors: 1. In the folder "stuff", use the signature file ~/.sig and the address [EMAIL PROTECTED] otherwise, use the default From: address and no sig 2. On any new message or replies to *@stuff.com, use the address [EMAIL PROTECTED] otherwise, default From: address 3. On any new message or replies From: [EMAIL PROTECTED], use the signature file ~/.sig otherwise, no sig 4. Reply to *all* messages with the realname set to Troy Davis but using the address that the message was sent to if it's one of my alternates -- a halfbaked reverse_name. Towards #1, #2, and #3, I have: set reverse_name set alternates=troy@(nack.net|stuff.com) # defaults send-hook . "unset signature" send-hook . "set hostname='nack.com'" # if it's To: or Cc: *@stuff.com, make it From: [EMAIL PROTECTED] send-hook '~C stuff\.com' "set hostname='stuff.com'" # if it's From: [EMAIL PROTECTED], use the sig send-hook '~f troy@stuff\.com' "set signature=~/.sig" # defaults folder-hook . "set hostname='nack.net'" folder-hook . "unset signature" # if it's in the encoding folder folder-hook =stuff "set hostname='stuff.com'" folder-hook =stuff "set signature=~/.sig" This has some definite inconsistencies. I think the biggest problem is that send-hook is just that: evaluated when the message is sent. I want it to be evaluated for the current message, when I hit reply or enter the To: address (ie, when it puts me into the body editing). Is there a hook like that is evaluated early enough in the message that I can make these determinations? I may be entirely missing something - if anyone does this or something like it, examples are welcome. As for #4 above, I have no idea. Do I need to code a reverse_addr? Thanks for any help. Cheers, Troy -