How to send email from PHP on XAMPP?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manu g
    New Member
    • Nov 2010
    • 2

    #1

    How to send email from PHP on XAMPP?

    i am using xampp as a server it has apache mercury and all..even if i rum mercury still i get the error

    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:\xampp\htdocs \mail.php on line 7

    my php.ini file has..
    [mail function]
    ; For Win32 only.
    ; http://php.net/smtp
    SMTP = localhost
    ; http://php.net/smtp-port
    smtp_port = 25

    and my php code is
    Code:
    <?php
    $to = "someone@example.com";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "someonelse@example.com";
    $headers = "From: $from";
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    ?>
    when i run portcheck in xampp it shows smtp port 25 as free
    please let me know what is the problem
Working...