tweeking contact form script for my server
I have set up the contact form script on a site I am building and thought all was OK except that I have noticed I get the 'thank you' page acknowledging an email has been sent even if an email hasn't been sent!?(when all fields have been correctly filled in)
It only appears to work(send an email to me) if I enter my own email address in the email address field on the contact form,in which case it sends an email to me - not a lot of use for customer enquiries as they will obviously all have a different email address to me!?
The link is here
I have looked at the server (fasthosts) help page and it gives some help - however I am uncertain how to edit the contact form code based on the help!? - could you give please explain EXACTLY the changes I would have to make to the contactform script based on the guidance below?
Full info at
Extract from Fasthosts help
To prevent spam being sent through our webservers, there are certain conditions that must be met before our SMTP servers will send the email.
1.Email must be sent to, or from, an existing email address hosted by Fasthosts. This must be a mailbox on the same domain name on which the form to mail script is being hosted.
2.To stop misuse of your form by third parties the sendmail_from variable should be set to your Fasthosts hosted email address. While access to the php.ini file is restricted on our shared environment, you can sent this variable using the ini_set() command, shown below.
3.A fifth parameter, -f, should be added to the sendmail function. This will set the name of the from email address.
In its basic form, a simple sendmail script will look like this:
mail($email_to, $email_subject, $email_message, $headers, "-email@example.com");
Provided that your form to mail script meets the requirements above, you should have no problems.