From mboxrd@z Thu Jan 1 00:00:00 1970 From: sgoldman@tower-research.com (Steve Goldman) Date: Wed, 22 Jul 2009 22:51:54 -0400 Subject: [sup-talk] Choose "From:" address based on message content? In-Reply-To: <1248311332-sup-1053@sgoldmanlinux.tower-research.com> References: <1248311332-sup-1053@sgoldmanlinux.tower-research.com> Message-ID: <1248317360-sup-4094@sgoldmanlinux.tower-research.com> Excerpts from Steve Goldman's message of Wed Jul 22 21:10:41 -0400 2009: > > Here's what I want: > > After I compose an email (new or a reply), I want sup to grep the > entire message (recipients, subject, body, etc.) for a single word and > choose address A if that word is there and address B otherwise. > > Can sup do it? > > Thanks. > I think I answered my own question. I added an "after-edit" hook call in edit-message-mode.rb and wrote a hook that looks like this: require 'eregex' r = Regexp.new('word', Regexp::IGNORECASE); if header.to_s.grep(r).size > 0 or body.to_s.grep(r).size > 0 header["From"] = "Steve Goldman " end -- Steve Goldman sgoldman at tower-research.com T: 212.219.6014 F: 212.219.6007 Tower Research Capital, LLC 377 Broadway, 11th Fl. New York, NY 10013