Is there a way to put an "IF" statement in local.cf?

I'm trying to put in a conditional statement in the local.cf 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 domain.com is in "Return-Path:" and "From:" line
then its good
else
its spam

Any thoughts on this approach?

thanks
Dean