>From 702b2cc1e652c1f20f4280b11355cb337291df87 Mon Sep 17 00:00:00 2001 From: Ben Walton <bwal...@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 <bwal...@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 _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk