hi,

I have xampp/eclipse/windowsxp. below code does not send any email. I dont know whether i need to do something with php.ini file. or i need mail server. I am new to this.

When i run the following code in eclipse, i get message saying Mail Sent but i never get any message in hotmail(not even in gmail ). I am not sure why?
<?php
$to = "safiullah12@hotmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "safiullah12@hotmail.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>


--------
installed directory as follows:
php.ini > c/program files/xampp/php/php.ini
sendmail > c/program files/xampp/sendmail/sendmail.ini
xampp > c/program files/xampp
eclipse > c/program files/eclipse

what works:
http://localhost/xampp/

does not work.
http://localhost/aaa/sendMail.php
if i run this php file, i get msg saying msg sent but i never got the email.

I am not sure how i can set up the sendmail.ini and php.ini file.

Pls help. thanks.

I am not sure but if it works under the Xampp folder and not the aaa folder than the issue is not with your code you have posted but with the configuration of Xampp. It isn't going to be your php.ini file since it only contains the host and port to use so if it were wrong it would not work in any directory.

You most likely have a permissions issue or configuration issue with the SMTP service running on the system. I would recommend trying the Xampp forums for assistance.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.