SmtpStripForgedFields
function SmtpStripForgedFields(const aData: tBytes; const aReceiver: string; aResults: Boolean; var aStripped: tSmtpStrippedFields): tBytes;
aData with the fields that claim to come from aReceiver RENAMED - every X-DNS-Warning and X-Stripped-Fields naming it, and every Authentication-Results naming it when aResults is True, each with cSmtpForgedFieldPrefix in front of its name and otherwise byte for byte in its place - and without every Authentication-Results bearing a version this unit does not support, whoever it names and whatever aResults says; each one is added to aStripped. Every other field, and the body, is copied byte for byte, and aData itself is returned when nothing changes. Data with no empty line ending a header section is not a message and is returned as it is. Run it on the message as received, AFTER DKIM verification has read it - a signature may cover a field this changes - and BEFORE the spam stage, so the forgeries reach tSpamContext.ForgedStamps in the same score.