By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,824 Members | 2,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,824 IT Pros & Developers. It's quick & easy.

how to send form data to email in php

P: 10
hi
i am trying send some data to email in php but i am getting below warning
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:\wamp\www\phpclasses\emaildemo.php on line 7

my code is

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3. $to = "chrbrameshbabu@gmail.com";
  4. $subject = "Test mail";
  5. $message = "Hello! This is a simple email message.";
  6. $from = "chrbrameshbabu@hotmail.com";
  7. $headers = "From:".$from;
  8. mail($to,$subject,$message,$headers);
  9. echo "Mail Sent.";
  10. ?>
  11.  
Feb 28 '12 #1
Share this Question
Share on Google+
1 Reply


helimeef
P: 77
Perhaps this poorly written but useful guide will help you.

Apache can't send email by default; it needs to be configured. That's why you're getting your error message.
Mar 26 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.