[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-101-g1252970

sartak at bestpractical.com sartak at bestpractical.com
Fri Jan 22 20:25:45 EST 2010


The branch, 3.8-trunk has been updated
       via  1252970656b9cbc3a5a509595b746eebc76320f6 (commit)
      from  33ca9a038a2eeb6a7f9e4b5ce8355f3229e29931 (commit)

Summary of changes:
 etc/RT_Config.pm.in        |    8 ++++++--
 lib/RT/Action/SendEmail.pm |    3 ++-
 lib/RT/Interface/Email.pm  |   21 ++++++++++++++-------
 3 files changed, 22 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit 1252970656b9cbc3a5a509595b746eebc76320f6
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jan 22 20:24:25 2010 -0500

    Allow setting $DefaultMailPrecedence and $DefaultErrorMailPrecedence to undef

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index de050a5..fd36848 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -432,6 +432,10 @@ your staff, you may wish to change it.
 Note that you can set the precedence of individual templates
 by including an explicit Precedence header.
 
+If you set this value to C<undef> then we do not set a default
+Precedence header to outgoing mail. However, if there already is a
+Precedence header it will be preserved.
+
 =cut
 
 Set($DefaultMailPrecedence, 'bulk');
@@ -445,8 +449,8 @@ Precedence level of outgoing mail that indicates some kind of
 error condition. By default it is C<bulk>, but if you only send
 mail to your staff, you may wish to change it.
 
-Note that you can set the precedence of individual templates
-by including an explicit Precedence header.
+If you set this value to C<undef> then we do not add a Precedence
+header to error mail.
 
 =cut
 
diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
index 5820a0c..56d00b4 100755
--- a/lib/RT/Action/SendEmail.pm
+++ b/lib/RT/Action/SendEmail.pm
@@ -608,7 +608,8 @@ sub SetRTSpecialHeaders {
     }
 
     $self->SetHeader( 'Precedence', RT->Config->Get('DefaultMailPrecedence') )
-        unless ( $self->TemplateObj->MIMEObj->head->get("Precedence") );
+        unless $self->TemplateObj->MIMEObj->head->get("Precedence")
+            && defined(RT->Config->Get('DefaultMailPrecedence'));
 
     $self->SetHeader( 'X-RT-Loop-Prevention', RT->Config->Get('rtname') );
     $self->SetHeader( 'RT-Ticket',
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index e6c8255..130be7b 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -245,16 +245,23 @@ sub MailError {
         level   => $args{'LogLevel'},
         message => $args{'Explanation'}
     ) if $args{'LogLevel'};
+
     # the colons are necessary to make ->build include non-standard headers
-    my $entity = MIME::Entity->build(
-        Type                   => "multipart/mixed",
-        From                   => $args{'From'},
-        Bcc                    => $args{'Bcc'},
-        To                     => $args{'To'},
-        Subject                => $args{'Subject'},
-        'Precedence:'          => RT->Config->Get('DefaultErrorMailPrecedence'),
+    my %entity_args = (
+        Type                    => "multipart/mixed",
+        From                    => $args{'From'},
+        Bcc                     => $args{'Bcc'},
+        To                      => $args{'To'},
+        Subject                 => $args{'Subject'},
         'X-RT-Loop-Prevention:' => RT->Config->Get('rtname'),
     );
+
+    # only set precedence if the sysadmin wants us to
+    if (defined(RT->Config->Get('DefaultErrorMailPrecedence'))) {
+        $entity_args{'Precedence:'} = RT->Config->Get('DefaultErrorMailPrecedence');
+    }
+
+    my $entity = MIME::Entity->build(%entity_args);
     SetInReplyTo( Message => $entity, InReplyTo => $args{'MIMEObj'} );
 
     $entity->attach( Data => $args{'Explanation'} . "\n" );

-----------------------------------------------------------------------


More information about the Rt-commit mailing list