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

There really isn’t much we can do, but a few suggestions:

  • You can add a Captcha to avoid bots and high volume spam.

  • You could add some sort of word-based spam filtering using code.

  • Check submitted contact entries with the Akismet anti-spam system.

  • There are also 3rd-party spam-filtering services that allow such services via API.