I installed Apache and PHP on my Windows 7 PC. I am learning PHP now. Next up is my PHP script to send email.
<?php if(isset($_REQUEST['email'])) { $email = $_REQUEST['email']; $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; mail(" padhy.surya@gmail.com ","$subject","$message","From:","$email"); echo "Thank you for using the email !!!"; } else { echo "Mail is not set properly. Please fill the form properly"; } ?>
I use the html form to get the necessary parameters for sending email. Below is the error that I receive while I am sending an email.
Warning: mail () [function.mail]: Failed to connect to the mail server in "localhost" 25, check the settings for "SMTP" and "smtp_port" in php.ini or use ini_set () in C: \ WebLearn \ Apache-2.2 \ htdocs \ SimpleWebsite \ contact.php on line 7
Do I need to install anything installed in the php.ini file or in httpd.conf? If so, how to configure it? Do I need an additional SMTP server on my PC to send email? Please suggest the necessary steps to send email from my local PC.
source share