PHP Form mail function not working?

Status
Not open for further replies.

stephsof

New Member
Messages
2
Reaction score
0
Points
0
Hey,

I cannot seem to get the mail(); function working with my contact form. I have tested the form in many ways and the only thing it is not doing is mailing the data.


Here is the code:

HTML:
<input type="submit" value="SEND" id="send" />  


<script>
$('#send').click(function(e) {
    e.preventDefault();


    var datastring = "to=contact@mydomain.com&subject=Contact&body=TEST";
    alert(datastring);


    $.ajax({
        type: "POST",
        url: "contact.php",
        data: datastring,
        success: function(data){
            console.log(data);
            alert("success!");
        }
    });
});
</script>

contact.php:

PHP:
<?php

$to = $_REQUEST['to'];
$subject = $_REQUEST['subject'];
$body = $_REQUEST['body'];

mail($to, $subject, $body);

$data = $to . ", " . $subject . ", " .  $body;
echo $data;

?>


Here is the page it's for http://stephaniesofokleous.co.uk/contact.html so you can see the console returning the data when you click the "send" button. It's just the mail part which isn't working. :confused::confused::confused:
 

hbazer

Member
Messages
398
Reaction score
7
Points
18
About 02:00 2013-03-21 UTC

Of the three (3) free-hosting servers only server [ Level ] will send Email at this time

but they all will send to their self - by putting a copy in their [ inbox ] (I think)
so be sure to use [ CC: ] or add the [ FROM: ] address to the [ TO: ] address
that way you might have a backup copy when the send to some other account fails

Only two things are for sure with free-hosting Email
#1 > If it is up it will go down
#2 > If it is down it will back up
 
Last edited:
Status
Not open for further replies.
Top