Bugzilla – Attachment 125238 Details for
Bug 28996
SendAlerts crashes on a bad email 'To'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28996: Catch error in mail creation
Bug-28996-Catch-error-in-mail-creation.patch (text/plain), 4.22 KB, created by
Didier Gautheron
on 2021-09-24 12:20:13 UTC
(
hide
)
Description:
Bug 28996: Catch error in mail creation
Filename:
MIME Type:
Creator:
Didier Gautheron
Created:
2021-09-24 12:20:13 UTC
Size:
4.22 KB
patch
obsolete
>From a9708d50b72dce8821599c1208a22c83fb85857a Mon Sep 17 00:00:00 2001 >From: Didier Gautheron <didier.gautheron@biblibre.com> >Date: Fri, 24 Sep 2021 14:07:45 +0200 >Subject: [PATCH] Bug 28996: Catch error in mail creation > >--- > C4/Letters.pm | 80 +++++++++++++++++++++++++-------------------------- > 1 file changed, 40 insertions(+), 40 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 87b82624c6..cd438ef548 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -324,24 +324,24 @@ sub SendAlerts { > ) or return; > > # FIXME: This 'default' behaviour should be moved to Koha::Email >- my $mail = Koha::Email->create( >- { >- to => $email, >- from => $library->branchemail, >- reply_to => $library->branchreplyto, >- sender => $library->branchreturnpath, >- subject => "" . $letter->{title}, >- } >- ); >+ my $success = try { >+ my $mail = Koha::Email->create( >+ { >+ to => $email, >+ from => $library->branchemail, >+ reply_to => $library->branchreplyto, >+ sender => $library->branchreturnpath, >+ subject => "" . $letter->{title}, >+ } >+ ); > >- if ( $letter->{is_html} ) { >- $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) ); >- } >- else { >- $mail->text_body( $letter->{content} ); >- } >+ if ( $letter->{is_html} ) { >+ $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) ); >+ } >+ else { >+ $mail->text_body( $letter->{content} ); >+ } > >- my $success = try { > $mail->send_or_die({ transport => $library->smtp_server->transport }); > } > catch { >@@ -475,33 +475,33 @@ sub SendAlerts { > > # ... then send mail > my $library = Koha::Libraries->find( $userenv->{branch} ); >- my $mail = Koha::Email->create( >- { >- to => join( ',', @email ), >- cc => join( ',', @cc ), >- ( >+ my $success = try { >+ my $mail = Koha::Email->create( >+ { >+ to => join( ',', @email ), >+ cc => join( ',', @cc ), > ( >- C4::Context->preference("ClaimsBccCopy") >- && ( $type eq 'claimacquisition' >- || $type eq 'claimissues' ) >- ) >- ? ( bcc => $userenv->{emailaddress} ) >- : () >- ), >- from => $library->branchemail >- || C4::Context->preference('KohaAdminEmailAddress'), >- subject => "" . $letter->{title}, >- } >- ); >+ ( >+ C4::Context->preference("ClaimsBccCopy") >+ && ( $type eq 'claimacquisition' >+ || $type eq 'claimissues' ) >+ ) >+ ? ( bcc => $userenv->{emailaddress} ) >+ : () >+ ), >+ from => $library->branchemail >+ || C4::Context->preference('KohaAdminEmailAddress'), >+ subject => "" . $letter->{title}, >+ } >+ ); > >- if ( $letter->{is_html} ) { >- $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) ); >- } >- else { >- $mail->text_body( "" . $letter->{content} ); >- } >+ if ( $letter->{is_html} ) { >+ $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) ); >+ } >+ else { >+ $mail->text_body( "" . $letter->{content} ); >+ } > >- my $success = try { > $mail->send_or_die({ transport => $library->smtp_server->transport }); > } > catch { >-- >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 28996
:
125238
|
125250