https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26922 Bug ID: 26922 Summary: SendAlerts does not correctly handle error on sending emails Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: ASSIGNED Severity: major Priority: P5 - low Component: System Administration Assignee: tomascohen@gmail.com Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com Depends on: 22343 When an email is sent from C4::Letters::SendAlerts (for instance emailing a acquisition basket), the UI displays a "all good" message even if the email has not been sent properly. To recreate: 1. Set KohaAdminEmailAddress to admin@example.org 2. Edit a vendor, set a valid email address 3. Create a new basket, a new order. Send the basket As you did not configure a valid SMTP server, the email is not sent and logs displayed "unable to establish SMTP connection to (localhost) port 25", with the stracktrace. The problem is coming from the return inside the catch (which returns from the catch, not the subroutine as expected). There are 2 problematic occurrences in SendAlerts: 360 try { 361 $mail->send_or_die({ transport => $library->smtp_server->transport }); 362 } 363 catch { 364 carp "$_"; 365 return { error => "$_" }; 366 }; 512 try { 513 $mail->send_or_die({ transport => $library->smtp_server->transport }); 514 } 515 catch { 516 carp "$_"; 517 return { error => "$_" }; 518 }; => SendAlerts will return 1 (from l.577) anyway. And 1 occurrence in _send_message_by_email that should be corrected to avoid confusion. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22343 [Bug 22343] Add configuration options for SMTP servers -- You are receiving this mail because: You are watching all bug changes.