Lines 77-84
sub create {
Link Here
|
77 |
|
77 |
|
78 |
my $args = {}; |
78 |
my $args = {}; |
79 |
$args->{from} = $params->{from} || C4::Context->preference('KohaAdminEmailAddress'); |
79 |
$args->{from} = $params->{from} || C4::Context->preference('KohaAdminEmailAddress'); |
80 |
Koha::Exceptions::BadParameter->throw("Invalid 'from' parameter: ".$args->{from}) |
80 |
Koha::Exceptions::BadParameter->throw( { parameter => 'from', error => "Invalid 'from' parameter: ".$args->{from} }) unless Email::Valid->address( -address => $args->{from}, -fqdn => 0 ); # from is mandatory |
81 |
unless Email::Valid->address( -address => $args->{from}, -fqdn => 0 ); # from is mandatory |
|
|
82 |
|
81 |
|
83 |
$args->{subject} = $params->{subject} // ''; |
82 |
$args->{subject} = $params->{subject} // ''; |
84 |
|
83 |
|
Lines 89-95
sub create {
Link Here
|
89 |
$args->{to} = $params->{to}; |
88 |
$args->{to} = $params->{to}; |
90 |
} |
89 |
} |
91 |
|
90 |
|
92 |
Koha::Exceptions::BadParameter->throw("Invalid 'to' parameter: ".$args->{to}) |
91 |
Koha::Exceptions::BadParameter->throw({ parameter => 'to', error => "Invalid 'to' parameter: ".$args->{to}}) |
93 |
unless Email::Valid->address( -address => $args->{to}, -fqdn => 0 ); # to is mandatory |
92 |
unless Email::Valid->address( -address => $args->{to}, -fqdn => 0 ); # to is mandatory |
94 |
|
93 |
|
95 |
my $addresses = {}; |
94 |
my $addresses = {}; |
Lines 109-116
sub create {
Link Here
|
109 |
} |
108 |
} |
110 |
|
109 |
|
111 |
foreach my $address ( keys %{$addresses} ) { |
110 |
foreach my $address ( keys %{$addresses} ) { |
112 |
Koha::Exceptions::BadParameter->throw( |
111 |
Koha::Exceptions::BadParameter->throw({ parameter => $address, error => |
113 |
"Invalid '$address' parameter: " . $addresses->{$address} ) |
112 |
"Invalid '$address' parameter: " . $addresses->{$address} }) |
114 |
if $addresses->{$address} and !Email::Valid->address( |
113 |
if $addresses->{$address} and !Email::Valid->address( |
115 |
-address => $addresses->{$address}, |
114 |
-address => $addresses->{$address}, |
116 |
-fqdn => 0 |
115 |
-fqdn => 0 |