[Rt-commit] r11031 - rt/branches/3.6-EXPERIMENTAL-ABERDEEN/lib/RT/Action

audreyt at bestpractical.com audreyt at bestpractical.com
Sun Mar 9 14:07:20 EDT 2008


Author: audreyt
Date: Sun Mar  9 14:07:19 2008
New Revision: 11031

Modified:
   rt/branches/3.6-EXPERIMENTAL-ABERDEEN/lib/RT/Action/RuleManager.pm

Log:
* RT::Action::RuleManager: If the autoreply body doesn't 
  look like it begins with a MIME header, then prepend
  two newlines to make it parsable by MIME::Parser.
  Suggested by Jesse Vincent.

Modified: rt/branches/3.6-EXPERIMENTAL-ABERDEEN/lib/RT/Action/RuleManager.pm
==============================================================================
--- rt/branches/3.6-EXPERIMENTAL-ABERDEEN/lib/RT/Action/RuleManager.pm	(original)
+++ rt/branches/3.6-EXPERIMENTAL-ABERDEEN/lib/RT/Action/RuleManager.pm	Sun Mar  9 14:07:19 2008
@@ -138,12 +138,22 @@
             $self->TicketObj->SetStatus($rule->Argument);
         }
         elsif ($handler eq 'Send the autoreply in this template:') {
+            my $body = $rule->Argument;
+
+            # If the body doesn't look like it has a header, prepend two newlines.
+            unless ($body =~ /^[\x21-\x7e]+:/ and $body =~ /\r?\n\r?\n/) {
+                $body = "\n\n$body";
+            }
+
             local $self->{TemplateObj} = bless {
                 user    => $self->CurrentUser,
-                fetched => { content => 1, queue => 1 },
+                fetched => {
+                    content => 1,
+                    queue   => 1,
+                },
                 values  => {
                     queue   => 0,
-                    content => $rule->Argument,
+                    content => $body,
                 },
             } => 'RT::Template';
 


More information about the Rt-commit mailing list