View | Details | Raw Unified | Return to bug 8000
Collapse All | Expand All

(-)a/C4/Installer/PerlDependencies.pm (-5 lines)
Lines 737-747 our $PERL_DEPS = { Link Here
737
        'required' => '0',
737
        'required' => '0',
738
        'min_ver'  => '0.89',
738
        'min_ver'  => '0.89',
739
    },
739
    },
740
    'Data::Validate::Email' => {
741
        'usage'    => 'Email validation',
742
        'required' => '1',
743
        'min_ver'  => '0.04',
744
    },
745
};
740
};
746
741
747
1;
742
1;
(-)a/C4/Letters.pm (-6 / +5 lines)
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 1154-1160 sub _send_message_by_email { Link Here
1154
        $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} );
1154
        $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} );
1155
    }
1155
    }
1156
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1156
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1157
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) );
1157
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) );
1158
    unless ($to_address) {
1158
    unless ($to_address) {
1159
        if (!$member) {
1159
        if (!$member) {
1160
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1160
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1161
- 

Return to bug 8000