Revision 758
- Date:
- 2018/12/04 09:22:10
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/core/lib/Contenido/Mail.pm
92 92 $to = '=?utf-8?B?'.$to.'?='; 93 93 push @to, $to.' <'.$eto.'>'; 94 94 } else { 95 push @to, $eto; 95 push @to, '<'.$eto.'>'; 96 96 } 97 97 } 98 $emailto = shift @to; 98 $emailto = join ', ', @to; 99 99 } else { 100 100 my ($to, $eto) = $email->{to} =~ /^(.*?)<(.*?)>/ ? ($1, $2) : $email->{to} =~ /<(.*?)>/ ? ('',$1) : ('',$email->{to}); 101 101 if ( $to ) { … … 106 106 } else { 107 107 $emailto = $eto; 108 108 } 109 @to = ($emailto); 109 110 } 110 111 111 112 my $ccmail; … … 118 119 } elsif ( exists $email->{cc} && $email->{cc} ) { 119 120 my ($cce, $ecce) = $email->{cc} =~ /^(.*?)<(.*?)>/ ? ($1, $2) : $email->{cc} =~ /<(.*?)>/ ? ('',$1) : ('',$email->{cc}); 120 121 $ccmail = join ', ', (@to, $ecce); 121 } elsif ( @to ) { 122 $ccmail = join ', ', @to; 123 122 } 124 123 125 124 my $body = $email->{body}; … … 166 165 } 167 166 } 168 167 unless ( $error ) { 169 $mailer->to( $emailto ); 168 $mailer->to( @to ); 170 169 unless ( $mailer->ok ) { 171 170 $error = $mailer->message; 172 171 } … … 208 207 my $que = Contenido::Email->new( $keeper ); 209 208 $que->status( 0 ); 210 209 if ( ref $email->{to} eq 'ARRAY' ) { 211 my $to = shift @{$email->{to}}; 212 return unless $to; 213 $que->name( $to ); 214 my @cc; 215 if ( scalar @{$email->{to}} ) { 216 push @cc, @{$email->{to}}; 217 } 218 if ( exists $email->{cc} && ref $email->{cc} eq 'ARRAY' ) { 219 push @cc, @{$email->{cc}}; 220 } elsif ( exists $email->{cc} && $email->{cc} ) { 221 push @cc, $email->{cc}; 222 } 223 if (@cc ) { 224 $que->cc( join("\n", @cc) ); 225 } 210 my @to = grep { $_ } @{$email->{to}}; 211 return unless @to; 212 $que->name( join ',', @to ); 226 213 } else { 214 return unless $email->{to}; 227 215 $que->name( $email->{to} ); 228 if ( exists $email->{cc} && ref $email->{cc} eq 'ARRAY' ) { 229 $que->cc( join("\n", @{$email->{cc}}) ); 230 } elsif ( exists $email->{cc} && $email->{cc} ) { 231 $que->cc( $email->{cc} ); 232 } 233 216 } 217 if ( exists $email->{cc} && ref $email->{cc} eq 'ARRAY' ) { 218 $que->cc( join("\n", @{$email->{cc}}) ); 219 } elsif ( exists $email->{cc} && $email->{cc} ) { 220 $que->cc( $email->{cc} ); 221 } 234 222 $que->subject( $email->{subject} ); 235 223 $que->body_html( $email->{body} ); 236 224 if ( exists $email->{text} ) { -
utf8/core/services/mail_process.pl
39 39 foreach my $row ( @$ids ) { 40 40 my $mail = $keeper->get_document_by_id($row->[0], class => 'Contenido::Email'); 41 41 if ( ref $mail ) { 42 my @to = split /,\s*/, $mail->name; 42 43 my $data = { 43 to => $mail->name, 44 to => \@to, 44 45 subject => $mail->subject, 45 46 body => $mail->body_html, 46 47 };