If you use a normal contact form then spammers will fond a way to
automatically send junk messages through that form, so you need a way
to verify that the sender is an actual person and not an automated
script.
A good solution for this is to use an random code that is generated
by a script the code will be displayed as an image so only a person
could read the image and type the number. This practice is called Captcha image validation. The image also has a noise added to avoid any existent automated scripts that could read the text from the image.
The contact form also makes sure the user filled all the form fields
correctly, when all fields are completed and the text entered inside
email box is an email address.
The contact form contents
The form will contain a link to an image, the link to image is
actually a link to a php file generating the image, user will have to
fill the image code inside a form field once with the other message
contents (subject, sender email, etc) then click submit, if the code in
the image will not be correct then message is not sent and user is
asked to fill the image code again, the other form fields remain
filled.