Fixed Bug : email sending test #36741 (#37107)

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 <eldy@destailleur.fr>
This commit is contained in:
DarmonNoah
2026-02-08 00:00:12 +01:00
committed by GitHub
parent ebce799bdb
commit 7cd3abb9f8

View File

@@ -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) {