Lines 35-41
use Date::Calc qw( Add_Delta_Days );
Link Here
|
35 |
use Encode; |
35 |
use Encode; |
36 |
use Carp; |
36 |
use Carp; |
37 |
use Koha::Email; |
37 |
use Koha::Email; |
38 |
use Data::Validate::Email qw(is_email); |
38 |
use Email::Valid; |
39 |
|
39 |
|
40 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
40 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
41 |
|
41 |
|
Lines 406-412
sub SendAlerts {
Link Here
|
406 |
my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); |
406 |
my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); |
407 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
407 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
408 |
my $email = $sendAllEmailsTo; |
408 |
my $email = $sendAllEmailsTo; |
409 |
if (!($sendAllEmailsTo && is_email($sendAllEmailsTo))){ |
409 |
if (!($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo))){ |
410 |
$email = $borinfo->{email} or next; |
410 |
$email = $borinfo->{email} or next; |
411 |
} |
411 |
} |
412 |
|
412 |
|
Lines 525-531
sub SendAlerts {
Link Here
|
525 |
my $emailsCC = join( ',', @cc); |
525 |
my $emailsCC = join( ',', @cc); |
526 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
526 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
527 |
# some validation. This could be improved. |
527 |
# some validation. This could be improved. |
528 |
if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ) { |
528 |
if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ) { |
529 |
$emailsTo = $sendAllEmailsTo; |
529 |
$emailsTo = $sendAllEmailsTo; |
530 |
$emailsCC = ''; |
530 |
$emailsCC = ''; |
531 |
} |
531 |
} |
Lines 585-591
sub SendAlerts {
Link Here
|
585 |
my $email = Koha::Email->new(); |
585 |
my $email = Koha::Email->new(); |
586 |
my $emailaddr = $externalid->{'emailaddr'}; |
586 |
my $emailaddr = $externalid->{'emailaddr'}; |
587 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
587 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
588 |
$emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); |
588 |
$emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); |
589 |
my %mail = $email->create_message_headers( |
589 |
my %mail = $email->create_message_headers( |
590 |
{ |
590 |
{ |
591 |
to => $emailaddr, |
591 |
to => $emailaddr, |
Lines 1150-1156
sub _send_message_by_email {
Link Here
|
1150 |
$to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} ); |
1150 |
$to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} ); |
1151 |
} |
1151 |
} |
1152 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
1152 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
1153 |
$to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); |
1153 |
$to_address = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); |
1154 |
unless ($to_address) { |
1154 |
unless ($to_address) { |
1155 |
if (!$member) { |
1155 |
if (!$member) { |
1156 |
warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})"; |
1156 |
warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})"; |
1157 |
- |
|
|