I got a template with Contact.html page. I create a contact.php for the contact form on the page.
Kindly check my Contact.php for the given contact form on Contact.html page and let me know what changes in code are required to make it working.
First, using the built-in PHP mail() function isn’t all that reliable, many would suggest using something like PHPMailer or other more modern library.
Second, you seem to be using the form-fillers email address as the “from” address for sending the email, which won’t work on a lot of mail servers. It is a bad thing to allow mail servers to send from any address, also known as “Open Relay”. Send it from your own email address.
But yes, tell us what error message you get, and on what line.
If the problem is that you just see your javascript alert error message window, that just means for some reason mail() has been unable to send the email to the mail server, but that’s all you can get from it. Another reason, I believe, that something like PHPMailer is considered better.