exchange – Reject emails whose header / envelope does not match

We have received spam / phishing emails that sometimes manage to route us and most have an email from our domain but their ENVELOPE comes from the junk email address.

From what I understand, SPF only checking the envelope, I thought, if it was possible, set up a rule that detects messages with a MAIL FROM message using our domain and an ENVELOPE address FROM incompatible.

If MAILFROM =  then (if MAILFROM! = ENVELOPEFROM then REJECT email)

Thanks in advance.