[Rt-commit] r6578 - in rt/branches/3.6-RELEASE: .
jesse at bestpractical.com
jesse at bestpractical.com
Fri Dec 1 14:00:39 EST 2006
Author: jesse
Date: Fri Dec 1 14:00:39 2006
New Revision: 6578
Modified:
rt/branches/3.6-RELEASE/ (props changed)
rt/branches/3.6-RELEASE/lib/RT/Action/SendEmail.pm
Log:
r45543 at pinglin (orig r6545): jesse | 2006-11-28 18:34:51 -0500
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-RELEASE/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/Action/SendEmail.pm (original)
+++ rt/branches/3.6-RELEASE/lib/RT/Action/SendEmail.pm Fri Dec 1 14:00:39 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