Php function: mail will not send emails

I can not get the php function: mail to actually send me mail.

$to = ‘’;
$subject = ‘the subject’;
$message = ‘hello’;
$headers = ‘From:’;
mail($to, $subject, $message, $headers);

Is there something missing or need programmed into “php.ini” for the email to work?

you have to set smtp port and smtp host in php.ini file

How do you set the SMTP port and host in the php.ini?

open php.ini file,find smtp port set 25 and smtp host is yours host like this

The port setting was right. I did not have to change it: “smtp_port = 25”.

I tried: and just: Neither of which worked.

What is it exactly do I write into “SMTP =” in the php.ini?

write your host name ,i have given jus example.

SMTP = (which is your host name put that here)

I have MSN Hotmail. My email is

I tried putting “” my incoming smtp mail from server that did not work.

Could you give some other examples of what works?

Or do you have to do something to the php.ini to initialize the new settings?

For what it’s worth, I have found that some hosting providers only support the PHP mail function on UNIX servers.

I have Apache version 2.2.21 but I have never used it.

How do I restart the apache server so that PHP modules and attributes from php.ini will be reloaded.

r u using xammp?

Thank you for the help. I just needed to configure the php.ini with the correct “” with a matching “smtp_port =25” and it works.