[Rt-commit] r7602 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Sat Apr 21 11:43:49 EDT 2007


Author: ruz
Date: Sat Apr 21 11:43:48 2007
New Revision: 7602

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm

Log:
 r5044 at cubic-pc:  cubic | 2007-04-21 18:43:25 +0400
 * move 'no recipients -> not sending' logic into RT::Interface::Email::SendEmail sub


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	Sat Apr 21 11:43:48 2007
@@ -329,6 +329,18 @@
         return 0;
     }
 
+    my $msgid = $args{'Entity'}->head->get('Message-ID') || '';
+    chomp $msgid;
+    
+    # If we don't have any recipients to send to, don't send a message;
+    unless ( $args{'Entity'}->head->get('To')
+        || $args{'Entity'}->head->get('Cc')
+        || $args{'Entity'}->head->get('Bcc') )
+    {
+        $RT::Logger->info( $msgid . " No recipients found. Not sending.\n" );
+        return -1;
+    }
+
     if ( $args{'Transaction'} && !$args{'Ticket'}
         && $args{'Transaction'}->ObjectType eq 'RT::Ticket' )
     {
@@ -351,9 +363,6 @@
         return $res unless $res > 0;
     }
 
-    my $msgid = $args{'Entity'}->head->get('Message-ID') || '';
-    chomp $msgid;
-
     unless ( $args{'Entity'}->head->get('Date') ) {
         require RT::Date;
         my $date = RT::Date->new( $RT::SystemUser );
@@ -553,8 +562,11 @@
     );
     return 1 unless $args{'Sign'} || $args{'Ecrypt'};
 
-    $RT::Logger->debug('Signing message') if $args{'Sign'};
-    $RT::Logger->debug('Encrypting message') if $args{'Ecrypt'};
+    my $msgid = $args{'Entity'}->head->get('Message-ID') || '';
+    chomp $msgid;
+
+    $RT::Logger->debug("$msgid Signing message") if $args{'Sign'};
+    $RT::Logger->debug("$msgid Encrypting message") if $args{'Ecrypt'};
 
     require RT::Crypt::GnuPG;
     my %res = RT::Crypt::GnuPG::SignEncrypt(
@@ -615,6 +627,7 @@
           || $args{'Entity'}->head->get('Cc')
           || $args{'Entity'}->head->get('Bcc') )
     {
+        $RT::Logger->debug("$msgid No recipients that have public key, not sending");
         return -1;
     }
 


More information about the Rt-commit mailing list