I am currently creating a contact form and with the help of thw world wide web I made a php background, which I also understand.
Unfortunately it looks al great to me, but I do get aan error, saying:
Warning: 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\jquery\mail.php on line 16 [line 16 is the place where the if statement with the mail and the attributes appaeat, see below]
I have honestly no clue what the error means, and my code is below, does anybody now what it means and how I could fix it? Thanks in advance!
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$city = $_POST['city'];
$message = $_POST['message'];
$from = 'From: timohoogie';
$to = 'ownemail@gmail.com';
$subject = 'Contact zoeken met whoduniit';
$human = $_POST['human'];
$body = "From: $name\n E-Mail: $email\n City: $city\n Message:\n $message";
if ($_POST['submit'] && $human == '4') {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Your message has been sent!</p>';
} else {
echo '<p>Something went wrong, go back and try again!</p>';
}
} else if ($_POST['submit'] && $human != '4') {
echo '<p>You answered the anti-spam question incorrectly!</p>';
}
?>
<form method="post" action="mail.php">
<label for="Name">Naam:</label>
<input type="text" name="name" id="name" />
<label for="City">Stad:</label>
<input type="text" name="city" id="city" />
<label for="email">Email:</label>
<input type="text" name="email" id="email" />
<label for="gevonden"> Hoe heeft u ons gevonden</label>
<input type="text" name="gevonden" id="gevonden" />
<br>
<br>
<label for="Message">Bericht:</label><br />
<textarea name="message" rows="20" cols="20" id="message"></textarea>
<label>*What is 2+2? (Anti-spam)</label>
<input name="human" placeholder="Type Here">
<input type="submit" name="submit" value="Submit" class="submit-button" />
</form>