hi, i have a hard time testing my PHP mail() function in the localhost.
can you teach me? it's my first time to use this mail() function.

this is my PHP code in the file: contact.php

<?php
    $email_to = $_REQUEST['email_to'];
    $subject = "Re: FAQ Suggestion";
    $email =  "d26thletter@yahoo.com";
    $message = $_REQUEST['message'] ;
    $headers = "From: $email";
    $sent = mail($email_to, $subject, $message, $headers) ;
    if($sent)
    {print "Your mail was sent successfully"; }
    else
    {print "We encountered an error sending your mail"; }
    ?>

when i run it in the localhost, i got this error message:

SMTP server response: 553 We do not relay non-local mail, sorry. in C:\xampp\htdocs\FAQ\contact.php on line 15
We encountered an error sending your mail

how could i make the mail() function work?

its becoz an email server is nt configured on your local machine...It wil work fine when u upload the file to the server....

This question has already been answered. Start a new discussion instead.