my $bcc = $tmplData->{'bcc'};
my $cc = $tmplData->{'cc'};
+ my $email_address = $cols->{'email'} || $cols->{'email_address'};
if ($send) {
+
# If we're sending email, then send it, optionally with a BCC.
- print "Sending to $cols->{'email'}" .
+ print "Sending to $email_address" .
($bcc ? "\n BCC " . (ref($bcc) eq 'ARRAY' ? join(", ", @{$bcc}) : $bcc) . " " : '') .
($cc ? "\n cC " . (ref($cc) eq 'ARRAY' ? join(", ", @{$cc}) : $cc) . " " : '') . "\n";
- my @emails = ( $cols->{'email'} );
+ my @emails = ( $email_address );
my $mail = MIME::Entity->build(
To => \@emails,
$mail->send('sendmail');
} else {
# Say who we want to send to.
- print "Want to send to: $cols->{'email'}" .
+ print "Want to send to: $email_address" .
(defined $bcc ? "\n BCC " . (ref($bcc) eq 'ARRAY' ? join(", ", @{$bcc}) : $bcc) . " " : '') .
(defined $cc ? "\n CC " . (ref($cc) eq 'ARRAY' ? join(", ", @{$cc}) : $cc) . " " : '') . "\n";
}