Lines 37-42
use Carp;
Link Here
|
37 |
use Koha::Email; |
37 |
use Koha::Email; |
38 |
use Koha::DateUtils qw( format_sqldatetime ); |
38 |
use Koha::DateUtils qw( format_sqldatetime ); |
39 |
use Data::Validate::Email qw(is_email); |
39 |
use Data::Validate::Email qw(is_email); |
|
|
40 |
use Email::Valid; |
40 |
|
41 |
|
41 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
42 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
42 |
|
43 |
|
Lines 417-423
sub SendAlerts {
Link Here
|
417 |
my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); |
418 |
my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); |
418 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
419 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
419 |
my $email = $sendAllEmailsTo; |
420 |
my $email = $sendAllEmailsTo; |
420 |
if (!($sendAllEmailsTo && is_email($sendAllEmailsTo))){ |
421 |
if (!($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo))){ |
421 |
$email = $borinfo->{email} or next; |
422 |
$email = $borinfo->{email} or next; |
422 |
} |
423 |
} |
423 |
|
424 |
|
Lines 538-544
sub SendAlerts {
Link Here
|
538 |
my $emailsCC = join( ',', @cc); |
539 |
my $emailsCC = join( ',', @cc); |
539 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
540 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
540 |
# some validation. This could be improved. |
541 |
# some validation. This could be improved. |
541 |
if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ) { |
542 |
if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ) { |
542 |
$emailsTo = $sendAllEmailsTo; |
543 |
$emailsTo = $sendAllEmailsTo; |
543 |
$emailsCC = ''; |
544 |
$emailsCC = ''; |
544 |
} |
545 |
} |
Lines 600-606
sub SendAlerts {
Link Here
|
600 |
my $email = Koha::Email->new(); |
601 |
my $email = Koha::Email->new(); |
601 |
my $emailaddr = $externalid->{'emailaddr'}; |
602 |
my $emailaddr = $externalid->{'emailaddr'}; |
602 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
603 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
603 |
$emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); |
604 |
$emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); |
604 |
my %mail = $email->create_message_headers( |
605 |
my %mail = $email->create_message_headers( |
605 |
{ |
606 |
{ |
606 |
to => $emailaddr, |
607 |
to => $emailaddr, |
Lines 1193-1199
sub _send_message_by_email {
Link Here
|
1193 |
$to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} ); |
1194 |
$to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} ); |
1194 |
} |
1195 |
} |
1195 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
1196 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
1196 |
$to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); |
1197 |
$to_address = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); |
1197 |
unless ($to_address) { |
1198 |
unless ($to_address) { |
1198 |
if (!$member) { |
1199 |
if (!$member) { |
1199 |
warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})"; |
1200 |
warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})"; |
1200 |
- |
|
|