Php function: mail will not send emails

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

<?php
$to = ‘nobody@example.com’;
$subject = ‘the subject’;
$message = ‘hello’;
$headers = ‘From: webmaster@example.com’;
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 example.com

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

I tried: webmaster@example.com and just: example.com. 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 = yoursite.net (which is your host name put that here)

I have MSN Hotmail. My email is name@live.com.

I tried putting “stmp.live.com” 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?

http://roshanbh.com.np/2007/12/sending-e-mail-from-localhost-in-php-in-windows-environment.html

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 “SMTP=smtp.mail.com” with a matching “smtp_port =25” and it works.