how to send form data to email in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rameshbabu1251
    New Member
    • Dec 2011
    • 10

    how to send form data to email in php

    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\php classes\emailde mo.php on line 7

    my code is

    Code:
    <?php
    $to = "chrbrameshbabu@gmail.com";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "chrbrameshbabu@hotmail.com";
    $headers = "From:".$from;
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    ?>
  • helimeef
    New Member
    • Sep 2007
    • 77

    #2
    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.

    Comment

    Working...