diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 46b485d8a3c..23b0fc5d6e2 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -920,6 +920,7 @@ class FormMail extends Form
*/
function setSubstitFromObject($object)
{
+ global $user;
$this->substit['__REF__'] = $object->ref;
$this->substit['__SIGNATURE__'] = $user->signature;
$this->substit['__REFCLIENT__'] = $object->ref_client;