hi pgr
I have done add those code, email is grouping together. I am using the text file in step 1 because I can’t store into the database.
Step1 - modules\AOP_Case_Updates\CaseUpdatesHook.php, line554: after send email
$message_id_1 = $mailer->getMessageID();
$myfile = fopen("messageid.txt","a") or die(" ");
$text = "".PHP_EOL."".$bean->id.":".$email.":".$message_id_1."";
fwrite($myfile,$text);
fclose($myfile);
Step2 - include\SugarPHPMailer.php: add new function
public function getMessageID(){
$message_id_0 = parent::getLastMessageID();
$GLOBALS['log']->debug("getLastMessageID_0: ".$message_id_0);
return $message_id_0;
}
Step3 - modules\AOP_Case_Updates\AOP_Case_Updates.php, line 306: after foreach email
$myfile = fopen("messageid.txt","r") or die(" ");
while (!feof($myfile)) {
$data = explode(":",fgets($myfile));
if($data[0]==$caseId && $data[1]==$email){
$mailer->addCustomHeader("In-Reply-To",$data[2]);
}
}
fclose($myfile);
Step1b (Not work) - modules\AOP_Case_Updates\CaseUpdatesHook.php, line554: after send email
$message_id_1 = $mailer->getMessageID();
$pointer = BeanFactory::getBean('Cases', $bean->id);
$pointer->message_id_c = $email.":".$message_id_1;
$pointer->save();
Step3b (Not work) - modules\AOP_Case_Updates\AOP_Case_Updates.php, line 306: after foreach email
$pointer = BeanFactory::getBean('Cases', $caseId);
$arr = $pointer->message_id_c;
$rows = explode(":",$arr);
$temp = false;
foreach($rows as $row){
if($temp){
$mailer->addCustomHeader("In-Reply-To",$row);
}
if($row == $email){
$temp = true;
}
}
Step1b and 3b don’t work because message id doesn’t store into the database.