Page 1 of 1

mail() function error.

Posted: Tue Oct 04, 2011 6:44 am
by sam.abey
Hi. i am new to php.. when i try to send an email using mail() function i am getting fallowing error..Can anyone please help me to find a solution for 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:\xampp\htdocs\cart\processfeedback.php on line 15..

my php code is

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$feedback = $_POST['feedback'];

$toaddress = "sam.abey@rocketmail.com";
$subject = "Feedback from the web site";

$mailcontent = "customer name: " . $name . "\n";
"customer email: " . $email . "\n";
"customer comment: \n" . $feedback . "\n";

$fromaddress = "From: sam.abey@rocketmail.com";

mail($toaddress, $subject, $mailcontent, $fromaddress);
?>

<html>
<head>
<title>process feedback</title>

</head>

<body>
<p>Feedback sent</p>
</body>
</html>

Re: mail() function erroe.

Posted: Tue Oct 04, 2011 6:46 am
by Celauran
Have you confirmed that your mail server is up and running correctly?

Re: mail() function error.

Posted: Tue Oct 04, 2011 6:52 am
by sam.abey
i dont know how to do that. i am completely new to this subject. i hosted this scripts in localhost.

Re: mail() function error.

Posted: Tue Oct 04, 2011 6:55 am
by Celauran

Re: mail() function error.

Posted: Tue Oct 04, 2011 6:58 am
by sam.abey
Celauran wrote:Suggested reading.
Thanx a lot

Re: mail() function error.

Posted: Tue Oct 04, 2011 7:46 am
by sam.abey
I found a solution for this error. The problem is It cannot connect to an smtp server and thats because i don't have installed mail server locally. so i downloaded hMailServer fromhttp://www.hmailserver.com..