[Rt-commit] r6545 - in rt/branches/3.6-EXPERIMENTAL-LONDRES: .

jesse at bestpractical.com jesse at bestpractical.com
Tue Nov 28 18:34:51 EST 2006


Author: jesse
Date: Tue Nov 28 18:34:51 2006
New Revision: 6545

Modified:
   rt/branches/3.6-EXPERIMENTAL-LONDRES/   (props changed)
   rt/branches/3.6-EXPERIMENTAL-LONDRES/lib/RT/Action/SendEmail.pm

Log:
 r45542 at 64:  jesse | 2006-11-28 18:34:07 -0500
  * Refactoring to add a method to just _send_ a MIME::Entity as email


Modified: rt/branches/3.6-EXPERIMENTAL-LONDRES/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.6-EXPERIMENTAL-LONDRES/lib/RT/Action/SendEmail.pm	(original)
+++ rt/branches/3.6-EXPERIMENTAL-LONDRES/lib/RT/Action/SendEmail.pm	Tue Nov 28 18:34:51 2006
@@ -259,9 +259,39 @@
     unless ($MIMEObj->head->get('Date')) {
         # We coerce localtime into an array since strftime has a flawed prototype that only accepts
         # a list
-      $self->SetHeader('Date', strftime('%a, %d %b %Y %H:%M:%S %z', @{[localtime()]}));
+      $MIMEObj->head->replace(Date => strftime('%a, %d %b %Y %H:%M:%S %z', @{[localtime()]}));
     }
 
+    return (0) unless ($self->OutputMIMEObject($MIMEObj));
+
+    my $success = $msgid . " sent ";
+    foreach( qw(To Cc Bcc) ) {
+        my $recipients = $MIMEObj->head->get($_);
+        $success .= " $_: ". $recipients if $recipients;
+    }
+    $success =~ s/\n//g;
+
+    $RT::Logger->info($success);
+
+    return (1);
+}
+
+
+=head2 OutputMIMEObject MIME::Entity
+
+Sends C<MIME::Entity> as an email message according to RT's mailer configuration.
+
+=cut 
+
+
+
+sub OutputMIMEObject {
+    my $self = shift;
+    my $MIMEObj = shift;
+    
+    my $msgid = $MIMEObj->head->get('Message-ID');
+    chomp $msgid;
+    
     my $SendmailArguments = $RT::SendmailArguments;
     if (defined $RT::VERPPrefix && defined $RT::VERPDomain) {
       my $EnvelopeFrom = $self->TransactionObj->CreatorObj->EmailAddress;
@@ -270,6 +300,7 @@
       $SendmailArguments .= " -f ${RT::VERPPrefix}${EnvelopeFrom}\@${RT::VERPDomain}";
     }
 
+
     if ( $RT::MailCommand eq 'sendmailpipe' ) {
         eval {
             # don't ignore CHLD signal to get proper exit code
@@ -318,17 +349,7 @@
             return (0);
         }
     }
-
-    my $success = $msgid . " sent ";
-    foreach( qw(To Cc Bcc) ) {
-        my $recipients = $MIMEObj->head->get($_);
-        $success .= " $_: ". $recipients if $recipients;
-    }
-    $success =~ s/\n//g;
-
-    $RT::Logger->info($success);
-
-    return (1);
+    return 1;
 }
 
 # }}}


More information about the Rt-commit mailing list