I\'m building a simple contact form for a website. It does not connect to a database, it just sends the email. Will this code prevent spammers from using header injections?
Nope, that doesn't sanitize anything.
It would be very very easy to fudge up that mailer.
I can add anything in a post value (that you read) to manipulate the mailer.