Jump to content

send email, how to solve this error?


nrsh_ram

Recommended Posts

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 = "[email protected]";
		$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

Link to comment
https://forums.phpfreaks.com/topic/145641-send-email-how-to-solve-this-error/
Share on other sites

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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.