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

(-)a/C4/Installer/PerlDependencies.pm (+5 lines)
Lines 787-792 our $PERL_DEPS = { Link Here
787
        'required' => '0',
787
        'required' => '0',
788
        'min_ver'  => '0.03',
788
        'min_ver'  => '0.03',
789
    },
789
    },
790
    'Data::Validate::Email' => {
791
        'usage'    => 'Email validation',
792
        'required' => '1',
793
        'min_ver'  => '0.04',
794
    },
790
};
795
};
791
796
792
1;
797
1;
(-)a/C4/Letters.pm (-5 / +5 lines)
Lines 36-41 use Encode; Link Here
36
use Carp;
36
use Carp;
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
40
40
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
41
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
41
42
Lines 416-422 sub SendAlerts { Link Here
416
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
417
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
417
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
418
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
418
            my $email = $sendAllEmailsTo;
419
            my $email = $sendAllEmailsTo;
419
            if (!($sendAllEmailsTo && $sendAllEmailsTo =~ /@/) ){ # some validation.  This could be improved.
420
            if (!($sendAllEmailsTo && is_email($sendAllEmailsTo))){
420
                $email = $borinfo->{email} or next;
421
                $email = $borinfo->{email} or next;
421
            }
422
            }
422
423
Lines 537-543 sub SendAlerts { Link Here
537
        my $emailsCC = join( ',', @cc);
538
        my $emailsCC = join( ',', @cc);
538
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
539
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
539
        # some validation.  This could be improved.
540
        # some validation.  This could be improved.
540
        if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ) {
541
        if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ) {
541
            $emailsTo = $sendAllEmailsTo;
542
            $emailsTo = $sendAllEmailsTo;
542
            $emailsCC = '';
543
            $emailsCC = '';
543
        }
544
        }
Lines 599-605 sub SendAlerts { Link Here
599
        my $email = Koha::Email->new();
600
        my $email = Koha::Email->new();
600
        my $emailaddr = $externalid->{'emailaddr'};
601
        my $emailaddr = $externalid->{'emailaddr'};
601
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
602
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
602
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
603
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) );
603
        my %mail  = $email->create_message_headers(
604
        my %mail  = $email->create_message_headers(
604
            {
605
            {
605
                to      => $emailaddr,
606
                to      => $emailaddr,
Lines 1192-1198 sub _send_message_by_email { Link Here
1192
        $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} );
1193
        $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} );
1193
    }
1194
    }
1194
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1195
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1195
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
1196
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) );
1196
    unless ($to_address) {
1197
    unless ($to_address) {
1197
        if (!$member) {
1198
        if (!$member) {
1198
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1199
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1199
- 

Return to bug 8000