Page 1 of 1

PHP email function

Posted: Thu Feb 23, 2012 6:01 am
by prog
HI,

I am using the following email function to mail

Code: Select all

<?php
$to = "xxx@xxx.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From:" . $from;
if(mail($to,$subject,$message,$headers))
{ echo "Mail sent"; }
else
{ echo "Mail failed"; }

?>
Im getting the error :
Warning: mail() [function.mail]: Failed to connect to mailserver at "127.0.0.1" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
But mt PHP.ini settings are:
SMTP 127.0.0.1
smtp_port 25

Anyone plz help...

Re: PHP email function

Posted: Thu Feb 23, 2012 6:03 am
by Celauran
Do you have a mail server running locally and listening on port 25?

Re: PHP email function

Posted: Thu Feb 23, 2012 6:05 am
by prog
No, I dont have server access with me & its not here