Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"

Hello everyone. I am tyring to send an email from my php script but I cant do it!
I have google this warning for about one day but I haven’t solve it yet!
Here is my php code:
[php]
$to = "[email protected]";
$subject = “Hi!”;
$body = “Hi,\n\nHow are you?”;
$headers = “From: $from \r\n” . ‘MIME-Version: 1.0’ . “\r\n” . ‘Content-type: text/html; charset=iso-8859-1’ . “\r\n”;

if (mail($to, $subject, $body,$headers)) {
echo(“

Message successfully sent!

”);
} else {
echo(“

Message delivery failed…

”);
}

[/php]

but everytime i get 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

I have download AppServ Open Project 2.5.10 for php and it works just fine.
[php]<?
phpinfo();
?>
[/php]

When I use this I get this info :
sendmail_from no value no value
sendmail_path no value no value
SMTP localhost localhost

Also in my php.ini I have this information:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = [email protected]

Is anybody familiar with this problem? I will appreciate any help! Something is going on with smtp server but I cant solve it!!Thanks in advance!

Are Some mail server installed?

Try to install sendmail it’s the most simple.

Do you know any reliable mail server that I can download and install so it can work?
And when I install the mail server, do I have to change any settings in the file php.ini ?

Sponsor our Newsletter | Privacy Policy | Terms of Service