If sendmail wasn't configured on your server or the code syntax is wrong you'll get the error message. Let's go back to the original form and use PHP to submit the form onto itself. Validating the syntax of email addresses using regular expressions You probably want to verify whether the emails you are getting say, for an opt-in newsletter are valid. To do this you'd first want to make sure the email looks like an email address. You can do this using a regular expression.
Regular expressions are a way to match patterns and characters.
The following first example is the pattern I created to validate emails. There are lots of regular expressions around and mine is not perfect nor am I saying it is the best, it is simply one you can use. Right now don't get hung up on what all those symbols mean, just understand that what this does is check an email address to see if it is in the correct format. Again, it isn't perfect, and often regular expressions never are an exact science. So this is one of those things where if you are close to exact it will have to work.