Subject: Re: [sup-talk] choosing signatures

From: Gregor Hoffleit <[email-masked]>
Date: Thu, 10 Jun 2010 18:08:34 +0200

* Eric Sherman <[email-masked]> [Do Jun 10 18:01:15 +0200 2010]
> Excerpts from Gregor Hoffleit's message of Thu Jun 10 11:52:25 -0400 2010:
> > at first, that looks like a duplication of code. Could you elaborate why
> > you use both of these hooks?
> 
> Yes.  The reply-from hook only triggers when replying, whereas the 
> before-edit hook triggers also when composing a new email.

Wouldn't the before-edit hook work for replying, as well?

    Gregor

> In this way I can ensure that for instance when I start a new thread to 
> recipients at my workplace or its vendors, the correct non-default From 
> address (and thusly the correct non-default sup account and signature and 
> so on) is selected.
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Daniel Goldin <[email-masked]>
Date: Sun, 06 Jun 2010 12:00:33 -0700

What an amazing and blazingly fast program sup is! But how does one choose
between different signatures when sending an email?  I couldn't find
anything on the wiki.

Non-programmer-type here -- so keep it easy, please.

d.

-- 
Daniel Goldin 
213.926.1960

---

From: Eric Sherman <[email-masked]>
Date: Thu, 10 Jun 2010 12:01:15 -0400

Excerpts from Gregor Hoffleit's message of Thu Jun 10 11:52:25 -0400 2010:
> Eric,

---

From: Eric Sherman <[email-masked]>
Date: Tue, 08 Jun 2010 07:57:54 -0400

Excerpts from Daniel Goldin's message of Tue Jun 08 01:16:25 -0400 2010:
> Thanks so much, works like a charm. But is there a way to change the
> "From:" and "In-reply-to:" and "Reply-to:" headers without having to add
> the config option ":ask_for_from: true"?

You may use the before-edit and reply-from hooks.  Here are scrubbed 
versions of mine:

before-edit.rb:
if header["To"] =~ /megacorp|ultramegacorp|alternacorp|minicorp|othercorp/
  header["From"] = "me <[email-masked]>"
elsif header["To"] =~ /somelist|alternalist|otherlist/
  header["From"] = "me <[email-masked]>"
end
header["Bcc"] = header["From"]

reply-from.rb:
val = case [message.recipient_email, message.to, message.cc, message.from].flatten.to_s
      when /megacorp|ultramegacorp|alternacorp|minicorp|othercorp/ then "me <[email-masked]>"
      when /personal.org/ then "me <[email-masked]>"
      when /nerdylistemail.org|somelist|alternalist|otherlist/ then "me <[email-masked]>"
      when /newemail/ then "me <[email-masked]>"
      when /oldemail/ then "me <[email-masked]>"
      end
Person.from_address val
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Gregor Hoffleit <[email-masked]>
Date: Thu, 10 Jun 2010 17:52:25 +0200

Eric,

    Gregor

* Eric Sherman <[email-masked]> [Di Jun 08 13:57:54 +0200 2010]

---

From: Daniel Goldin <[email-masked]>
Date: Tue, 08 Jun 2010 09:57:22 -0700

Thank you so much! Works perfectly.

d.

---

From: Richard Heycock <[email-masked]>
Date: Mon, 07 Jun 2010 14:36:02 +1000

> Non-programmer-type here -- so keep it easy, please.

Just replace :default with a name and repeat that block:

edit $HOME/.sup/config.yaml

  ...

  :accounts:
    :default:
      :sendmail: /usr/sbin/sendmail -oem -ti
      :name: <name>
      :email: <email address>
      :signature: <path to signature file>
    :<name>:
      :sendmail: /usr/sbin/sendmail -oem -ti
      :name: <name>
      :email: <email address>
      :signature: <path to signature file>

  ...

You can have as many account entries as you like.

Also See:
    http://sup.rubyforge.org/wiki/wiki.pl?MultipleAccountsAndReply

rgh
-- 
Richard Heycock

http://topikality.com

+61 (0) 410 646 369
[e]:  [email-masked]
[im]: [email-masked]

---

From: Daniel Goldin <[email-masked]>
Date: Mon, 07 Jun 2010 22:16:25 -0700

---

From: Gregor Hoffleit <[email-masked]>
Date: Mon, 14 Jun 2010 11:46:47 +0200

* Eric Sherman <[email-masked]> [Do Jun 10 19:02:45 +0200 2010]
> Excerpts from Gregor Hoffleit's message of Thu Jun 10 12:08:34 -0400 2010:
> I imagine so, and peeking quickly at reply-mode.rb seems to confirm this.  
> I probably wrote these way back when starting to use sup when I assumed 
> that before-edit only fired on new emails and reply-from only fired on 
> replies.  The next time I need to change their behavior I'll probably 
> DRY-ify my hooks.  Thanks for pointing this out.

Short update: When I tried your code, I couldn't get before-edit work as
expected. Appearently, the before-edit hook is called multiple times in
reply-mode, with varying headers, which broke my naive transformations:
Subsequent calls reverted/overwrote changes made in earlier calls.

I haven't looked in depth at this, though.

    Gregor

---

From: Eric Sherman <[email-masked]>
Date: Thu, 10 Jun 2010 13:02:45 -0400