Revision 757

Date:
2018/11/30 19:04:29
Author:
ahitrov
Revision Log:
Add to mail queue now can accept array_ref in {to} field

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/core/lib/Contenido/Mail.pm

     
    207 207
    208 208 my $que = Contenido::Email->new( $keeper );
    209 209 $que->status( 0 );
    210 $que->name( $email->{to} );
    210 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 }
    226 } else {
    227 $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 }
    211 234 $que->subject( $email->{subject} );
    212 235 $que->body_html( $email->{body} );
    213 236 if ( exists $email->{text} ) {
    214 237 $que->body_text( $email->{text} );
    215 238 }
    216 if ( exists $email->{cc} && ref $email->{cc} eq 'ARRAY' ) {
    217 $que->cc( join("\n", @{$email->{cc}}) );
    218 } elsif ( exists $email->{cc} && $email->{cc} ) {
    219 $que->cc( $email->{cc} );
    220 }
    221 239 if ( exists $email->{date} && ref $email->{date} eq 'DateTime' ) {
    222 240 $que->dtime( $email->{date}->ymd('-').' '.$email->{date}->hms );
    223 241 } elsif ( exists $email->{date} && $email->{date} ) {