View Full Version : mail() settings for php.ini

12-06-2008, 10:31 AM

can anyone tell
what are the setting to do in php.ini to work the mail()

im just trying to send mail by using a very simple php function mail() ,but it is giving me the successfully delivered Msg but there is no mail in my inbox

here is the sample code

$to = "email@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

if ($to){
mail($to, $subject, $body);
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");

in php.ini these are my settings for the mail()

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = me@example.com

do i need to change anything else

thanks in advance

12-06-2008, 11:39 AM
you need to upload your site / script to a host which allows mail in a PHP environment

you need an SMTP server installed if your trying to send mail from your local machine

12-06-2008, 07:25 PM

xampp will install mercury mail, which will allow your php mail function to function

alternatively, use the real deal in a sandbox

1. get a visualization software (virtualbox recommended)
2. install linux in a virtual environment (ubuntu recommended)
3. install apache, php, mysql and sendmail
4. you have a real linux local server in a sandbox