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

ruz at bestpractical.com ruz at bestpractical.com
Mon Sep 18 12:02:15 EDT 2006


Author: ruz
Date: Mon Sep 18 12:02:04 2006
New Revision: 5980

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

Log:
 r3771 at cubic-pc:  cubic | 2006-09-18 20:11:51 +0400
 ::Interface::Email::SendEmail
 * add Date header to entity if it's not defined already
 ** it's merge from 3.6-RELEASE of revisions 5518 and 5872


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	Mon Sep 18 12:02:04 2006
@@ -275,10 +275,20 @@
 
 sub SendEmail {
     my (%args) = (
-                  entity => undef,
-                  bounce => 0,
-                  @_,
-                 );
+        entity => undef,
+        bounce => 0,
+        @_,
+    );
+    unless ( $args{'entity'} ) {
+        $RT::Logger->crit( "Could not send mail without 'entity' object" );
+        return 0;
+    }
+    unless ( $args{'entity'}->head->get('Date') ) {
+        require RT::Date;
+        my $date = RT::Date->new( $RT::SystemUser );
+        $date->SetToNow;
+        $args{'entity'}->head->set( 'Date', $date->RFC2822( Timezone => 'server' ) );
+    }
 
     if ( RT->Config->Get('MailCommand') eq 'sendmailpipe' ) {
         my $path = RT->Config->Get('SendmailPath');
@@ -304,7 +314,7 @@
                 $RT::Logger->warning( "$path exitted with status $?" );
             }
         };
-        if ($@) {
+        if ( $@ ) {
             $RT::Logger->crit( "Could not send mail: " . $@ );
             return 0;
         }


More information about the Rt-commit mailing list