Add a Authentication-Results Header Field (https://tools.ietf.org/html/rfc7001).
Follow the instructions in our manual to add our package repository and then run the below command.
apt-get install halon-extras-authentication-results
yum install halon-extras-authentication-results
import { dmarc } from "extras://dmarc";
import { AuthenticationResults } from "extras://authentication-results";
$spf = spf_query($connection["remoteip"], $connection["helo"]["host"], $transaction["senderaddress"]["domain"]);
$dmarc = dmarc($arguments["mail"], $connection["remoteip"], $connection["helo"]["host"], $transaction["senderaddress"]["domain"]);
$dkims = [];
foreach ($arguments["mail"]->getHeaders("DKIM-Signature", ["field" => true]) as $i => $dkimsign)
{
if ($i >= 5) break;
$dkims[] = $arguments["mail"]->verifyDKIM($dkimsign);
}
$arguments["mail"]->addHeader("Authentication-Results",
AuthenticationResults(["hostname" => gethostname()])
->SPF($spf, $connection["helo"]["host"], $transaction["senderaddress"]["domain"], ["smtp.remote-ip" => $connection["remoteip"]])
->DKIM($dkims)
->DMARC($dmarc)
->toString(["multiline" => true]),
["encode" => false]
);