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

(-)a/Koha/Email.pm (-6 / +9 lines)
Lines 76-82 sub create { Link Here
76
    my $args = {};
76
    my $args = {};
77
    $args->{from} = $params->{from} || C4::Context->preference('KohaAdminEmailAddress');
77
    $args->{from} = $params->{from} || C4::Context->preference('KohaAdminEmailAddress');
78
    Koha::Exceptions::BadParameter->throw("Invalid 'from' parameter: ".$args->{from})
78
    Koha::Exceptions::BadParameter->throw("Invalid 'from' parameter: ".$args->{from})
79
        unless Email::Valid->address($args->{from}); # from is mandatory
79
        unless Email::Valid->address( -address => $args->{from}, -fqdn => 0 ); # from is mandatory
80
80
81
    $args->{subject} = $params->{subject} // '';
81
    $args->{subject} = $params->{subject} // '';
82
82
Lines 88-94 sub create { Link Here
88
    }
88
    }
89
89
90
    Koha::Exceptions::BadParameter->throw("Invalid 'to' parameter: ".$args->{to})
90
    Koha::Exceptions::BadParameter->throw("Invalid 'to' parameter: ".$args->{to})
91
        unless Email::Valid->address($args->{to}); # to is mandatory
91
        unless Email::Valid->address( -address => $args->{to}, -fqdn => 0 ); # to is mandatory
92
92
93
    my $addresses = {};
93
    my $addresses = {};
94
    $addresses->{reply_to} = $params->{reply_to};
94
    $addresses->{reply_to} = $params->{reply_to};
Lines 106-114 sub create { Link Here
106
            if exists $params->{bcc};
106
            if exists $params->{bcc};
107
    }
107
    }
108
108
109
    foreach my $address ( keys %{ $addresses } ) {
109
    foreach my $address ( keys %{$addresses} ) {
110
        Koha::Exceptions::BadParameter->throw("Invalid '$address' parameter: ".$addresses->{$address})
110
        Koha::Exceptions::BadParameter->throw(
111
            if $addresses->{$address} and !Email::Valid->address($addresses->{$address});
111
            "Invalid '$address' parameter: " . $addresses->{$address} )
112
          if $addresses->{$address} and !Email::Valid->address(
113
            -address => $addresses->{$address},
114
            -fqdn    => 0
115
          );
112
    }
116
    }
113
117
114
    $args->{cc} = $addresses->{cc}
118
    $args->{cc} = $addresses->{cc}
115
- 

Return to bug 28017