From 2003f4bf95714fb25f90f2eafc5c0c90ff21256b Mon Sep 17 00:00:00 2001 From: Sai Asish Y Date: Sun, 26 Apr 2026 18:11:09 -0700 Subject: [PATCH] fix(ticket): correct misleading MAIN_DISABLE_ALL_MAILS fallback error (#37994) (#37995) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sendTicketMessageByEmail() unconditionally told the admin 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS' whenever sendfile() returned false and $mailfile->error was empty. sendfile() can also fail with an empty error on transient SMTP errors or connection timeouts, so the message lied whenever MAIN_DISABLE_ALL_MAILS was not actually configured — confusing admins about why delivery failed. Branch on getDolGlobalString('MAIN_DISABLE_ALL_MAILS'): * true -> keep the disabled-feature notice * false -> fall through to ErrorFailedToSendMail and a syslog entry noting sendfile() returned false with no specific error. Fixes #37994 Signed-off-by: SAY-5 Co-authored-by: Laurent Destailleur --- htdocs/ticket/class/ticket.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index d5fca1dd441..d9f54cf8f66 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -3308,12 +3308,12 @@ class Ticket extends CommonObject $langs->load("other"); if ($mailfile->error) { setEventMessages($langs->trans('ErrorFailedToSendMail', $from, $receiverstring), null, 'errors'); - dol_syslog($langs->trans('ErrorFailedToSendMail', $from, $receiverstring).' : '.$mailfile->error); + dol_syslog('ErrorFailedToSendMail from='.$from.' to='.$receiverstring.' : '.$mailfile->error); } elseif (getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) { setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'errors'); } else { setEventMessages($langs->trans('ErrorFailedToSendMail', $from, $receiverstring), null, 'errors'); - dol_syslog('ErrorFailedToSendMail (no error details) from='.$from.' to='.$receiverstring, LOG_WARNING); + dol_syslog('ErrorFailedToSendMail from='.$from.' to='.$receiverstring.' : (no error details)', LOG_WARNING); } } }