Bugzilla – Attachment 123470 Details for
Bug 28803
process_message_queue.pl dies if any messsages in the message queue contain an invalid to_address
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28803: Add invalid email handling in _send_message_by_email
Bug-28803-Add-invalid-email-handling-in-sendmessag.patch (text/plain), 2.28 KB, created by
Martin Renvoize (ashimema)
on 2021-08-05 07:49:22 UTC
(
hide
)
Description:
Bug 28803: Add invalid email handling in _send_message_by_email
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-08-05 07:49:22 UTC
Size:
2.28 KB
patch
obsolete
>From eb79df5b7feb6e28dc98c460a96a0447d7cb99f9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 5 Aug 2021 08:00:19 +0100 >Subject: [PATCH] Bug 28803: Add invalid email handling in > _send_message_by_email > >This patch adds a try/catch block around the call to Koha::Email->create >to catch and handle invalid emails being passed in the parameters. > >The message is marked as 'failed' with an error_code of 'INVALID_EMAIL' >and the exception message being recorded in the delivery_note. >--- > C4/Letters.pm | 43 +++++++++++++++++++++++++++++-------------- > 1 file changed, 29 insertions(+), 14 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 177a4f51f6..f253f776b1 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1381,20 +1381,35 @@ sub _send_message_by_email { > }); > return; > }; >- my $email = Koha::Email->create( >- { >- to => $to_address, >- ( >- C4::Context->preference('NoticeBcc') >- ? ( bcc => C4::Context->preference('NoticeBcc') ) >- : () >- ), >- from => $from_address, >- reply_to => $message->{'reply_address'} || $branch_replyto, >- sender => $branch_returnpath, >- subject => "" . $message->{subject} >- } >- ); >+ my $email = try { >+ Koha::Email->create( >+ { >+ to => $to_address, >+ ( >+ C4::Context->preference('NoticeBcc') >+ ? ( bcc => C4::Context->preference('NoticeBcc') ) >+ : () >+ ), >+ from => $from_address, >+ reply_to => $message->{'reply_address'} || $branch_replyto, >+ sender => $branch_returnpath, >+ subject => "" . $message->{subject} >+ } >+ ); >+ } >+ catch { >+ my $exception = $_; >+ _set_message_status( >+ { >+ message_id => $message->{'message_id'}, >+ status => 'failed', >+ delivery_note => $exception->message, >+ error_code => 'INVALID_EMAIL' >+ } >+ ); >+ return 0; >+ }; >+ return unless $email; > > if ( $is_html ) { > $email->html_body( >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28803
:
123469
|
123470
|
123475
|
123476
|
124000
|
124001
|
124131
|
124132
|
124746
|
124829
|
124878
|
124879
|
124880
|
124886
|
124887
|
124888
|
124900
|
124901
|
124902
|
125114
|
125115
|
125343
|
125344
|
125345
|
125346