Skip to content

Commit

Permalink
Do not send a rejection reply in case of auto mails (such like delive…
Browse files Browse the repository at this point in the history
…ry state info)
  • Loading branch information
larhip committed Aug 11, 2021
1 parent 4a0363a commit 0e72f77
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions datamodel.itop-standard-email-synchro.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1189,18 +1189,20 @@ EOF
$this->sLastError = "Unknown caller (".$oEmail->sCallerEmail.")";
// if rejection reply
$sRejectionReply = $this->Get('unknown_caller_rejection_reply');
if (!empty($sRejectionReply) && $oRawEmail)
{
$sReplySubject = '[iTop] '.$oEmail->sSubject.' - '.$this->sLastError;
$sReplyBody = str_replace("\n", "<br/>", $sRejectionReply);
$sReplyTo = $oEmail->sCallerEmail;
$aTo = $oRawEmail->GetTo();
$sReplyFrom = $aTo[0]['email'];
$this->Trace("From: ".$sReplyFrom."\nTo: ".$sReplyTo."\n".$sReplySubject."\n\n".$sReplyBody);
$oRawEmail->SendAsAttachment($sReplyTo, $sReplyFrom, $sReplySubject, $sReplyBody);
// do not send rejection reply in case of an auto reply
if(!method_exists($oEmail, "IsAutoReplyEmail") || !$oEmail->IsAutoReplyEmail()){
$sReplySubject = '[iTop] '.$oEmail->sSubject.' - '.$this->sLastError;
$sReplyBody = str_replace("\n", "<br/>", $sRejectionReply);
$sReplyTo = $oEmail->sCallerEmail;
$aTo = $oRawEmail->GetTo();
$sReplyFrom = $aTo[0]['email'];
$this->Trace("From: ".$sReplyFrom."\nTo: ".$sReplyTo."\n".$sReplySubject."\n\n".$sReplyBody);
$oRawEmail->SendAsAttachment($sReplyTo, $sReplyFrom, $sReplySubject, $sReplyBody);
$this->sLastError .= " - Replied to sender on ".date('r');
$this->sLastError .= " - Replied to sender on ".date('r');
}
}
// Send to contact
Expand Down

0 comments on commit 0e72f77

Please sign in to comment.