Hi,
I have a script for sending an email from a form on a website. I know the code is fine - I've previously tested with two different hosting companies. This time I'm using it on a an actual server, as opposed to a hosting company. Basically the user fills in the form, clicks submit and gets the confirmation page that the message has been sent. The only thing is no email comes. Here is the script:
$nickname = $_REQUEST['nickname'] ;
$email = $_REQUEST['email'] ;
$tel = $_REQUEST['tel'] ;
$comp = $_REQUEST['comp'] ;
$message = $_REQUEST['message'] ;
// Let's check if all fields are filled in!
if(empty($nickname) || empty($email) || empty($comp))
{
$error = "All of the required fields have not been completed, <a href=\"javascript:history.go(-1)\">please click here to go back.</a>";
}
else
{
$content= "$nickname has sent you an e-mail from XXX
Query:
$message
You can contact $nickname via Email: $email. <br />Other relevant details of individual: <br />Telephone Number: $tel <br />Company: $comp";
mail( "[email protected]", "Query", $content, "From: $email"); //first thing has to be address it is going to, then what the subject of the mail should be, the content and a from address which will be the query submitter.
echo "<h2>$nickname</h2><br></br>
Your query has been succesfully sent. <br></br><br></br>
We will deal with this query and be in touch as soon as possible.<br></br><br></br><br></br>
The contact details you submitted are: <br></br><br></br>
<strong>Email:</strong> $email<br></br><br></br>
<strong>Phone:</strong> $tel<br></br><br></br>
<strong>Company:</strong> $comp<br></br><br></br>
<a //href=\"javascript:history.go(-1)\"> Click here to return to the contact page.</a></br>";
};
?>
I don't know if this matters either but up until recently, PHP would not work on the server, and gave a HTTP error 405 error saying the verb was not allowed. This has since been resolved.