I'm making a contact form so that someone can send a message to a specified email. However, I get an error message which is very persistent and won't go away:
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\mail.php on line 10
I tried putting in ini_set() on line 10 as specified, however it doesn't change anything. I tried researching what might be the case, but so far haven't come across anything. I was thinking maybe WAMP doesn't support mail.
HTML Code
<form action = "mail.php" method= "POST">
<p>Name</p> <input name = "name" type = "text">
<p>Email</p> <input name = "email" type = "text">
<p>Message</p><textarea name = "message" rows = "6" cols = "25"></textarea><br />
<input value = "Send" type = "submit" >
<input value = "Reset Form" type = "reset">
</form>
Where a form is successfully made which sends data to mail.php through the submit button.
PHP code
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$recipient = "To: myawesome.email@gmail.com";
$mailheader = "From: $name \r\n";
$formcontent= "From: $email \r\n Message: $message";
mail($recipient, $mailheader, $formcontent) or die("Error!");
echo "Your message has been delivered." . " -" . "<a href='form.html' style='text-decoration: none; color: #ff0099;'> Return Home </a>";
?>
Where mail.php is supposed to take $recipient, $mailheader, and $formcontent and email them to the specified address.
Any help is much appreciated.