nrsh_ram Posted February 17, 2009 Share Posted February 17, 2009 i have create forgetpassword.php <?php $msg=""; if(isset($_POST['Submit'])) { if(empty($_POST['studentname'])) { $msg="Mentee Name cannot be empty."; } elseif(empty($_POST['Loginid'])) { $msg="Mentee Login id cannot be empty."; } elseif(empty($_POST['comments'])) { $msg="comments cannot be empty."; } else { $to = "smiiledaa@gmail.com"; $subject = 'MSU - Fogot Password'; $message = "\n Mentee Name:".$_POST['studentname']."\n Mentee Login id :".$_POST['Loginid']."\n".$_POST['comments']; $headers = "From: MSI\r\n"; mail($to, $subject, $message, $headers); header("Location: mindex.php"); } } ?> when i run this page ...it show the error...how to fix this error? 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:\Program Files\xampp\htdocs\nrsh\forgetpassword.php on line 24 Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\xampp\htdocs\nrsh\forgetpassword.php:24) in C:\Program Files\xampp\htdocs\nrsh\forgetpassword.php on line 25 Quote Link to comment https://forums.phpfreaks.com/topic/145641-send-email-how-to-solve-this-error/ Share on other sites More sharing options...
premiso Posted February 17, 2009 Share Posted February 17, 2009 In order to use Mail on a Windows environment you need to use SMTP, and in order to use SMTP you must have a server setup. I would suggest looking into phpGMailer and GMail for a free smtp that allows 100 emails a day to be sent. Quote Link to comment https://forums.phpfreaks.com/topic/145641-send-email-how-to-solve-this-error/#findComment-764578 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.