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

Thanks! I’ve tried that already (a dedicated gmail email) but it didn’t help