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

(-)a/C4/Letters.pm (-7 / +17 lines)
Lines 1406-1418 sub _send_message_by_email { Link Here
1406
        );
1406
        );
1407
    }
1407
    }
1408
    catch {
1408
    catch {
1409
        _set_message_status(
1409
        if ( ref($_) eq 'Koha::Exceptions::BadParameter' ) {
1410
            {
1410
            _set_message_status(
1411
                message_id   => $message->{'message_id'},
1411
                {
1412
                status       => 'failed',
1412
                    message_id   => $message->{'message_id'},
1413
                failure_code => 'INVALID_EMAIL'
1413
                    status       => 'failed',
1414
            }
1414
                    failure_code => "INVALID_EMAIL:$_->parameter"
1415
        );
1415
                }
1416
            );
1417
        } else {
1418
            _set_message_status(
1419
                {
1420
                    message_id   => $message->{'message_id'},
1421
                    status       => 'failed',
1422
                    failure_code => 'UNKNOWN_ERROR'
1423
                }
1424
            );
1425
        }
1416
        return 0;
1426
        return 0;
1417
    };
1427
    };
1418
    return unless $email;
1428
    return unless $email;
(-)a/Koha/Email.pm (-5 / +4 lines)
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
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt (-2 / +1 lines)
Lines 95-101 Link Here
95
        [% IF ( QUEUED_MESSAGE.failure_code ) %]
95
        [% IF ( QUEUED_MESSAGE.failure_code ) %]
96
            [% IF ( QUEUED_MESSAGE.failure_code == "INVALID_BORNUMBER" ) %]Invalid borrowernumber [% borrowernumber | html %]
96
            [% IF ( QUEUED_MESSAGE.failure_code == "INVALID_BORNUMBER" ) %]Invalid borrowernumber [% borrowernumber | html %]
97
            [% ELSIF ( QUEUED_MESSAGE.failure_code == 'NO_EMAIL' ) %]Unable to find an email address for this borrower
97
            [% ELSIF ( QUEUED_MESSAGE.failure_code == 'NO_EMAIL' ) %]Unable to find an email address for this borrower
98
            [% ELSIF ( QUEUED_MESSAGE.failure_code == "INVALID_EMAIL" ) %]Invalid email address found [% borrowernumber | html %]
98
            [% ELSIF (matches = QUEUED_MESSAGE.failure_code.match('INVALID_EMAIL:(\w+)') ) %]Invalid [% matches.0 | html %] email address found [% borrowernumber | html %]
99
            [% ELSIF ( QUEUED_MESSAGE.failure_code == 'NO_FROM' ) %]Missing from email address
99
            [% ELSIF ( QUEUED_MESSAGE.failure_code == 'NO_FROM' ) %]Missing from email address
100
            [% ELSIF ( QUEUED_MESSAGE.failure_code == 'MISSING_SMS' ) %]Missing SMS number
100
            [% ELSIF ( QUEUED_MESSAGE.failure_code == 'MISSING_SMS' ) %]Missing SMS number
101
            [% ELSIF ( QUEUED_MESSAGE.failure_code == 'DUPLICATE_MESSAGE' ) %]Message is duplicate
101
            [% ELSIF ( QUEUED_MESSAGE.failure_code == 'DUPLICATE_MESSAGE' ) %]Message is duplicate
102
- 

Return to bug 28803