AbhiN Posted February 8, 2008 Share Posted February 8, 2008 i m developing php page.. i've feedback form containing the fields name,email and comments,.. Using php i want to pass this data to comapanies mail addr.. i've tried to develope php as-- <?php $name = $_POST["name"]; $email = $_POST["email"]; $comments = $_POST["comments"]; $subject = "Feedback"; $sendto = 'feedback@3esolutionsindia.com'; $body = "comments: $comments\n"; $body = wordwrap($body, 70); $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: <webmaster@example.com>' . "\r\n"; $headers .= 'Cc: myboss@example.com' . "\r\n"; mail($sendto, $subject, $body, $headers); echo "Thanks for your Feedback"; echo "Visit again"; ?> Now for time being i m using -- $name = "abhi"; $email = "employee1.3e@gmail.com"; $comments = "demo"; to check the php.. i've installed Apache HTTP server 2.0 on my pc and tried to run this php.. 3emails.php is in folder-- C:\Program Files\Apache Group\Apache2\htdocs path to run -- http://localhost/3esmail.php then it gives error as-- Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache Group\Apache2\htdocs\3esmail.php on line 20 Thanks for your FeedbackVisit again then i've set in php.ini --- [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = NULL then what is the problem?? wheather the php is correct?? how shold i check?? plz reply.. byee.. Quote Link to comment https://forums.phpfreaks.com/topic/90036-php-mail/ Share on other sites More sharing options...
Wolphie Posted February 8, 2008 Share Posted February 8, 2008 In order to be able to send mail locally you need to have a mail server installed on the local machine. Quote Link to comment https://forums.phpfreaks.com/topic/90036-php-mail/#findComment-461622 Share on other sites More sharing options...
AbhiN Posted February 8, 2008 Author Share Posted February 8, 2008 thnks for quick reply.. but can u tell which r the mail servers.. or plz give some reference links for mail servers.. ok bye Quote Link to comment https://forums.phpfreaks.com/topic/90036-php-mail/#findComment-461627 Share on other sites More sharing options...
Wolphie Posted February 8, 2008 Share Posted February 8, 2008 Download something named XAMPP from apachefriends.org They have a built in mail server Quote Link to comment https://forums.phpfreaks.com/topic/90036-php-mail/#findComment-461631 Share on other sites More sharing options...
aschk Posted February 8, 2008 Share Posted February 8, 2008 PHP is looking for a mail server on localhost (which is YOUR pc). Now i'm just taking a guess but I would say you're unlikely to have a mail server installed on your PC. Thus the mail function will not work until you have one. Alternatively as an option do what Wolphie suggests and download/install XAMPP which has lots of nice built-in bits (such as a mail server). Quote Link to comment https://forums.phpfreaks.com/topic/90036-php-mail/#findComment-461633 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.