[Rt-commit] r10939 - rt/branches/3.7-EXPERIMENTAL/lib/RT/Action

ruz at bestpractical.com ruz at bestpractical.com
Tue Feb 26 16:03:19 EST 2008


Author: ruz
Date: Tue Feb 26 16:02:44 2008
New Revision: 10939

Modified:
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm

Log:
* use parts_DFS instead of push-pop

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	Tue Feb 26 16:02:44 2008
@@ -194,22 +194,13 @@
     $self->SetHeader( 'Content-Transfer-Encoding','8bit');
 
     # For security reasons, we only send out textual mails.
-    my @parts = $MIMEObj;
-    while (my $part = shift @parts) {
-        if ($part->is_multipart) {
-            push @parts, $part->parts;
-        }
-        else {
-            if ( RT::I18N::IsTextualContentType( $part->mime_type ) ) {
-                $part->head->mime_attr( "Content-Type" => $part->mime_type )
-            } else {
-                $part->head->mime_attr( "Content-Type" => 'text/plain' );
-            }
-            $part->head->mime_attr( "Content-Type.charset" => 'utf-8' );
-        }
+    foreach my $part ( grep !$_->is_multipart, $MIMEObj->parts_DFS ) {
+        my $type = $part->mime_type || 'text/plain';
+        $type = 'text/plain' unless RT::I18N::IsTextualContentType( $type );
+        $part->head->mime_attr( "Content-Type" => $type );
+        $part->head->mime_attr( "Content-Type.charset" => 'utf-8' );
     }
 
-
     RT::I18N::SetMIMEEntityToEncoding(
         $MIMEObj,
         RT->Config->Get('EmailOutputEncoding'),


More information about the Rt-commit mailing list