Jump to content

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 = "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

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.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.