From 2796c406a22267547910d9962cc15fd0792fee26 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 19 Mar 2014 10:37:57 +0100 Subject: [PATCH] Bug 8000: Replace Data::Validate::Email with Email::Valid --- C4/Installer/PerlDependencies.pm | 5 ----- C4/Letters.pm | 10 +++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index 9996ef1..67ec808 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -737,11 +737,6 @@ our $PERL_DEPS = { 'required' => '0', 'min_ver' => '5.61', }, - 'Data::Validate::Email' => { - 'usage' => 'Email validation', - 'required' => '1', - 'min_ver' => '0.04', - }, }; 1; diff --git a/C4/Letters.pm b/C4/Letters.pm index eb908fa..abc4350 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -35,7 +35,7 @@ use Date::Calc qw( Add_Delta_Days ); use Encode; use Carp; use Koha::Email; -use Data::Validate::Email qw(is_email); +use Email::Valid; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -406,7 +406,7 @@ sub SendAlerts { my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); my $email = $sendAllEmailsTo; - if (!($sendAllEmailsTo && is_email($sendAllEmailsTo))){ + if (!($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo))){ $email = $borinfo->{email} or next; } @@ -525,7 +525,7 @@ sub SendAlerts { my $emailsCC = join( ',', @cc); my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); # some validation. This could be improved. - if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ) { + if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ) { $emailsTo = $sendAllEmailsTo; $emailsCC = ''; } @@ -585,7 +585,7 @@ sub SendAlerts { my $email = Koha::Email->new(); my $emailaddr = $externalid->{'emailaddr'}; my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); - $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); + $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); my %mail = $email->create_message_headers( { to => $emailaddr, @@ -1150,7 +1150,7 @@ sub _send_message_by_email { $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} ); } my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); - $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); + $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); unless ($to_address) { if (!$member) { warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})"; -- 1.9.1