Am trying to create a mail funciton from php. It showing error like

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()

i cheked my php.ini file also in directory C:\wamp\bin\apache\Apache2.2.17\bin\php.ini. I found

SMTP = localhost
smtp_port = 25
sendmail_from = santosh_shah777@yahoo.com
mail.add_x_header = On

Is there anything wrong with my php.ini am using wamp 2.1
my php code

<html>
<body>

		<?php 
		
			$to = "sks7u@yahoo.com";
			$subject="test Mail";
			$message="Hello ! This is a test Message";
			$from = "santosh_shah777@yahoo.com";
			$headers="From :" . $from;
				mail($to,$subject,$message,$headers);
				echo "Mail sent";
		
		?>

</body>
</html>

Your installation doesn't have a mail server on localhost you can connect to. I suggest you search this forum for phpmailer.

mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini.

SNIP

do i need to configure it manually or i need to reinstall it again.. How to do that.. I search phpmailer but i didnt get that horrible code. can you suggest it please :(

getting mad of cause of this SMTP will anyone explain it more clearly.. :(

You can only connect to SMTP on localhost, if you have an SMTP server running there (which I doubt). If you use PHPMailer, then you can use your e-mail provider to send email (or yahoo, or gmail, whatever).

Suppose you want to use Yahoo, then you can find example like this one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.