Mail() [Function.mail]: Failed To Connect To Mailserver At "localhost" Port 25,
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>
brainfo
Junior Poster in Training
63 posts since Sep 2011
Reputation Points: 5
Solved Threads: 1
Your installation doesn't have a mail server on localhost you can connect to. I suggest you search this forum for phpmailer.
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
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 :(
brainfo
Junior Poster in Training
63 posts since Sep 2011
Reputation Points: 5
Solved Threads: 1
getting mad of cause of this SMTP will anyone explain it more clearly.. :(
brainfo
Junior Poster in Training
63 posts since Sep 2011
Reputation Points: 5
Solved Threads: 1
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 .
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875