0

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>
3
Contributors
5
Replies
15
Views
5 Years
Discussion Span
Last Post by pritaeas
0

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

0

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

SNIP

Edited by happygeek: Fake sig

0

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

0

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.