import rt 3.6.6
[freeside.git] / rt / lib / RT / Ticket_Overlay.pm
index 5960f0b..b4e3259 100644 (file)
@@ -1349,7 +1349,7 @@ sub AddWatcher {
     #If the watcher we're trying to add is for the current user
     if ( $self->CurrentUser->PrincipalId == ($args{'PrincipalId'} || 0)
        or    lc( $self->CurrentUser->UserObj->EmailAddress )
-          eq lc( RT::User::CanonicalizeEmailAddress(undef, $args{'Email'}) || '' ) )
+          eq lc( RT::User->CanonicalizeEmailAddress( $args{'Email'} ) || '' ) )
     {
         #  If it's an AdminCc and they don't have 
         #   'WatchAsAdminCc' or 'ModifyTicket', bail
@@ -2410,15 +2410,16 @@ sub _RecordNote {
 # The "NotifyOtherRecipients" scripAction will look for RT-Send-Cc: and RT-Send-Bcc:
 # headers
 
-    $args{'MIMEObj'}->head->add( 'RT-Send-Cc', RT::User::CanonicalizeEmailAddress(
-                                                     undef, $args{'CcMessageTo'}
-                                 ) )
-      if defined $args{'CcMessageTo'};
-    $args{'MIMEObj'}->head->add( 'RT-Send-Bcc',
-                                 RT::User::CanonicalizeEmailAddress(
-                                                    undef, $args{'BccMessageTo'}
-                                 ) )
-      if defined $args{'BccMessageTo'};
+
+    foreach my $type (qw/Cc Bcc/) {
+        if ( defined $args{ $type . 'MessageTo' } ) {
+
+            my $addresses = join ', ', (
+                map { RT::User->CanonicalizeEmailAddress( $_->address ) }
+                    Mail::Address->parse( $args{ $type . 'MessageTo' } ) );
+            $args{'MIMEObj'}->head->add( 'RT-Send-' . $type, $addresses );
+        }
+    }
 
     # If this is from an external source, we need to come up with its
     # internal Message-ID now, so all emails sent because of this