How do I create a contact form that allow me to block spams by collecting their IP address?

One way you could handle this would be to use a dedicated Gmail or Yahoo mail account for all emails coming in from the contact page. That would at least keep the garbage out of your private or company email account.