I have an html form which includes input fields.i want it to be sent to a email using Php. I am working on local server (wamp). And on my php.ini file i have this.
*[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from ="admin@wampserver.invalid"*
Php code
<?php
//if "email" variable is filled out, send email
if (isset($_REQUEST['email'])) {
//Email information
$admin_email = "multani92@aol.com";
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$comment = $_REQUEST['comment'];
//send email
mail($email, "$subject", $comment, "From:" . $admin_email);
//Email response
echo "Thank you for contacting us!";
}
//if "email" variable is not filled out, display the form
else {
?>
<form method="post">
NAME:* <input name="name" type="text" required/><br />
EMAIL:* <input name="name" type="text" required/><br />
COMMENTS:<br />
<textarea name="comment" rows="15" cols="40"></textarea><br />
<input type="submit" value="Submit" />
</form>
I am getting this Error.
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\trying.php on line 12.
I think i need to fix something in the php.ini file but not sure.