I'm almost done designing my very first website... about to put it into wordpress...
In my Contact page I want to test my mail function to see if that works, I use WAMP and when I click on Submit button it says Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\html\contactengine.php on line 30
My codes:
HTML:
<form method="POST" action="contactengine.php" id="commentForm">
<fieldset>
<div id="formLeft">
<label for="Name">name:</label>
<div class="input-bg">
<input type="text" name="Name" id="Name" class="required" minlength="2" />
</div>
<label for="City">city:</label>
<div class="input-bg">
<input type="text" name="Subject" id="Subject" class="required" minlength="2" />
</div>
<label for="Email">Email:</label>
<div class="input-bg">
<input type="text" name="Email" id="Email" class="required email" />
</div>
</div>
<div id="formRight">
<td><label for="Message">Message:</label></td>
<div class="message-bg">
<textarea name="Message" id="Message" rows="20" cols="20" class="required"></textarea>
</div>
<br />
<input type="image" src="images/send-button.jpg" name="submit" value="Submit" class="submit-button" />
</div>
<div class="clear"></div>
</fieldset>
</form>
And PHP page:
<?php
// CHANGE THE VARIABLES BELOW
$EmailFrom = "REDACTED";
$EmailTo = "REDACTED";
$Subject = "Contact Form Submission";
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
// CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
/*
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
*/
?>
I need to set it up on my Gmail account... Please help me with it, it took my whole day after checking tons of tutorials :(