From 7cd3abb9f85a6e697f2f0df4c83e8df0afba183b Mon Sep 17 00:00:00 2001 From: DarmonNoah <152853486+DarmonNoah@users.noreply.github.com> Date: Sun, 8 Feb 2026 00:00:12 +0100 Subject: [PATCH] Fixed Bug : email sending test #36741 (#37107) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed Bug : email sending test #36741 @defrance --> Issue fixed The problem was caused by initializing $result = 0 in core/actions_sendmails.inc.php. When sending a test email from Setup → Emails, there is no $object to fetch. As a result, $result remained 0 and the code incorrectly triggered ErrorFailedToReadObject. The fix consists in explicitly setting $result = 1 when no $object is provided (test email / generic email context). This correctly treats the absence of an object as a valid case and restores the ability to send test emails, while keeping $result properly initialized. Co-authored-by: Laurent Destailleur --- htdocs/core/actions_sendmails.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 665751ff28f..5dcdffd95eb 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -189,6 +189,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO } } else { $thirdparty = $mysoc; + $result = 1; // No object to fetch (e.g. Setup -> Emails -> send test email): consider OK } if ($result > 0) {