PDA

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


swetha123
12-06-2008, 10:31 AM
hello,

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

<?php
$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

davidj
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

ranjan
12-06-2008, 07:25 PM
http://www.apachefriends.org/en/xampp-windows.html

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