Is there a way to put an "IF" statement in

I'm trying to put in a conditional statement in the to check the return
path and the from line.

Most of the time when I see a spoofed name its one or the other not both.
So what I'm thinking is:

If is in "Return-Path:" and "From:" line
then its good
its spam

Any thoughts on this approach?