[Rt-commit] r7917 - in rt/branches/3.7-EXPERIMENTAL-RTIR-2.4: lib/RT/Interface

ruz at bestpractical.com ruz at bestpractical.com
Wed May 23 23:00:34 EDT 2007


Author: ruz
Date: Wed May 23 23:00:34 2007
New Revision: 7917

Modified:
   rt/branches/3.7-EXPERIMENTAL-RTIR-2.4/etc/RT_Config.pm.in
   rt/branches/3.7-EXPERIMENTAL-RTIR-2.4/lib/RT/Interface/Email.pm

Log:
* add ForwardFromUser option

Modified: rt/branches/3.7-EXPERIMENTAL-RTIR-2.4/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-RTIR-2.4/etc/RT_Config.pm.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL-RTIR-2.4/etc/RT_Config.pm.in	Wed May 23 23:00:34 2007
@@ -282,6 +282,13 @@
 
 Set($RecordOutgoingEmail, 1);
 
+# By default, RT forwards a message using queue's address and adds RT's tag into
+# subject of the outgoing message, so recipients' replies go into RT as correspondents.
+# To change this behavior, set $ForwardFromUser to 0 and RT will use address of the
+# current user and leave subject without RT's tag.
+
+Set($ForwardFromUser, 0);
+
 # }}}
 
 # {{{ GnuPG

Modified: rt/branches/3.7-EXPERIMENTAL-RTIR-2.4/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-RTIR-2.4/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL-RTIR-2.4/lib/RT/Interface/Email.pm	Wed May 23 23:00:34 2007
@@ -529,11 +529,24 @@
         To => $args{'To'},
         Cc => $args{'Cc'},
         Bcc => $args{'Bcc'},
-        Subject => 'Fwd: '. ($txn->Subject || $txn->Object->Subject ),
         Type => 'message/rfc822',
         Encoding => '8bit',
         Data => $entity->as_string,
     );
+
+    my $from;
+    my $subject = $txn->Subject || $txn->Object->Subject;
+    if ( RT->Config->Get('ForwardFromUser') ) {
+        $from = $txn->CurrentUser->UserObj->EmailAddress;
+    } else {
+        # XXX: what if want to forward txn of other object than ticket?
+        $subject = AddSubjectTag( $subject, $txn->ObjectId );
+        $from = $txn->Object->QueueObj->CorrespondAddress
+            || RT->Config->Get('CorrespondAddress');
+    }
+    $mail->head->set( Subject => "Fwd: $subject" );
+    $mail->head->set( From    => $from );
+
     my $status = SendEmail( Entity => $mail, Transaction => $txn );
     return (0, $txn->loc("Couldn't send email")) unless $status;
     return (1, $txn->loc("Send email successfully"));


More information about the Rt-commit mailing list