Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: bwalton@cquest.utoronto.ca (Ben Walton)
Subject: [sup-talk] (no subject)
Date: Sun, 31 May 2009 21:01:10 -0400	[thread overview]
Message-ID: <200906010101.n5111ADJ007928@ntdws12.chass.utoronto.ca> (raw)

From 702b2cc1e652c1f20f4280b11355cb337291df87 Mon Sep 17 00:00:00 2001
From: Ben Walton <bwalton at artsci.utoronto.ca>
Date: Sun, 31 May 2009 20:37:11 -0400
Subject: [PATCH] Add bounce message feature

By pressing ! in thread view mode, a message can be re-injected to the
mail system without any modification.  The interesting/useful property
of this feature is that, because only the envelope sender changes, the
mail will show up at the new destination with the original From:
header.  A use case for this is redirecting mail sent to an individual
into a ticket system such that the original sender gets the
auto-response.

Signed-off-by: Ben Walton <bwalton at artsci.utoronto.ca>
---
 lib/sup/modes/thread-view-mode.rb |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
index 42c6280..4737dde 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -41,6 +41,7 @@ EOS
 #    k.add :collapse_non_new_messages, "Collapse all but unread messages", 'N'
     k.add :reply, "Reply to a message", 'r'
     k.add :forward, "Forward a message or attachment", 'f'
+    k.add :bounce, "Bounce message to other recipient(s)", '!'
     k.add :alias, "Edit alias/nickname for a person", 'i'
     k.add :edit_as_new, "Edit message as new", 'D'
     k.add :save_to_disk, "Save message/attachment to disk", 's'
@@ -172,6 +173,24 @@ EOS
     end
   end
 
+  def bounce
+    m = @message_lines[curpos] or return
+    to = BufferManager.ask_for_contacts(:people, "Bounce To: ") or return
+
+    if BufferManager.ask_yes_or_no "Really bounce to #{to.join(', ')}?"
+      cmd = "sendmail -oem -i #{to.map { |t| t.email}.join(' ')}"
+      begin
+        IO.popen(cmd, 'w') do |sm|
+          sm.puts m.raw_message
+        end
+        raise SendmailCommandFailed, "Couldn't execute #{cmd}" unless $? == 0
+      rescue SystemCallError, SendmailCommandFailed => e
+        Redwood::log "Problem sending mail: #{e.message}"
+        BufferManager.flash "Problem sending mail: #{e.message}"
+      end
+    end
+  end
+
   include CanAliasContacts
   def alias
     p = @person_lines[curpos] or return
-- 
1.6.3



             reply	other threads:[~2009-06-01  1:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01  1:01 Ben Walton [this message]
2009-06-01  1:04 ` Ben Walton
2009-06-01  2:13 ` Ben Walton
2009-06-04  2:04 ` Ross Macduff
  -- strict thread matches above, loose matches on Subject: below --
2011-12-10  3:08 Jason O'Conal
2010-11-15  0:49 Matthias Vallentin
2010-11-15  1:42 ` Edward Z. Yang
2010-11-15  6:57   ` Matthias Vallentin
2010-11-15  8:06     ` Helge Titlestad
2010-11-20 19:04       ` Matthias Vallentin
2010-11-21  1:10         ` Tero Tilus
2010-11-21  1:51           ` Matthias Vallentin
2010-11-15  1:46 ` Ben Walton
2010-11-15  1:50 ` Matias Aguirre
2009-06-08  0:02 Ben Walton
2009-06-11 23:50 ` Ben Walton
2009-06-12  3:44   ` William Morgan
2009-06-12 13:15     ` Ben Walton
2009-06-12 18:23 ` William Morgan
2009-02-16  6:45 Michael John Stipicevic
2009-02-16  6:45 Michael John Stipicevic
2009-02-16  6:45 Michael John Stipicevic
2009-02-16  6:45 Michael John Stipicevic
2009-02-16  6:45 Michael John Stipicevic
2009-02-16  6:45 Michael John Stipicevic
2009-02-16  6:45 Michael John Stipicevic
2009-02-16  6:44 Michael John Stipicevic
2009-02-16  6:27 Michael John Stipicevic
2009-02-16  6:25 Michael John Stipicevic
2009-02-16  6:25 Michael John Stipicevic
2009-02-16  6:25 Michael John Stipicevic
2009-02-16  6:25 Michael John Stipicevic
2009-02-16  6:25 Michael John Stipicevic
2009-02-16  6:25 Michael John Stipicevic
2009-02-16  6:25 Michael John Stipicevic
2009-02-16  8:53 ` Ian Smith
2009-02-16 14:08   ` William Morgan
2009-02-16 14:42     ` Mike Stipicevic
2009-02-16  6:25 Michael John Stipicevic
2008-01-05 19:29 thefed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200906010101.n5111ADJ007928@ntdws12.chass.utoronto.ca \
    --to=bwalton@cquest.utoronto.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox