diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 4c77566eeed..c23545a34c9 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -85,7 +85,7 @@ class FormMail extends Form
public $toid;
/**
- * @var string replyto name
+ * @var string Reply-to name
*/
public $replytoname;
@@ -95,20 +95,25 @@ class FormMail extends Form
public $replytomail;
/**
- * @var string to name
+ * @var string To name
*/
public $toname;
/**
- * @var string to email
+ * @var string To email
*/
public $tomail;
/**
- * @var string trackid
+ * @var string Track id
*/
public $trackid;
+ /**
+ * @var string If you know a MSGID of an email and want to send the email in reply to it. Will be added into header as In-Reply-To: <...>
+ */
+ public $inreplyto;
+
public $withsubstit; // Show substitution array
public $withfrom;
@@ -449,6 +454,7 @@ class FormMail extends Form
$out .= '';
$out .= '';
$out .= '';
+ $out .= '';
}
if (!empty($this->withfrom)) {
if (!empty($this->withfromreadonly)) {
@@ -458,7 +464,7 @@ class FormMail extends Form
}
foreach ($this->param as $key => $value) {
if (is_array($value)) {
- $out .= "\n";
+ $out .= "\n";
} else {
$out .= ''."\n";
}
diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php
index 9e0a38bee39..0376a5e85c9 100644
--- a/htdocs/core/tpl/card_presend.tpl.php
+++ b/htdocs/core/tpl/card_presend.tpl.php
@@ -147,7 +147,8 @@ if ($action == 'presend') {
$formmail->fromtype = 'special';
}
- $formmail->trackid = $trackid;
+ $formmail->trackid = empty($trackid) ? '' : $trackid;
+ $formmail->inreplyto = empty($inreplyto) ? '' : $inreplyto;
$formmail->withfrom = 1;
// Fill list of recipient with email inside <>.
diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php
index c1a4ca94045..3d11afc5900 100644
--- a/htdocs/recruitment/recruitmentcandidature_card.php
+++ b/htdocs/recruitment/recruitmentcandidature_card.php
@@ -652,6 +652,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$defaulttopic = 'InformationMessage';
$diroutput = $conf->recruitment->dir_output;
$trackid = 'recruitmentcandidature'.$object->id;
+ $inreplyto = $object->email_msgid;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
}