I managed to make my contact form work but somehow i cant make it send the message structured how i want…
My code is this:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$messagesubject = $_POST['subject'];
$text = $_POST['text'];
$to = "name@email.com";
$subject = 'Message from a site visitor '.$name;
$content = 'Name: '.$name."\\r\
";
$content .= 'E-mail: '.$email."\\r\
";
$content .= 'Subject: '.$messagesubject."\\r\
";
$content .= 'Message: '.$text."\\r\
";
$send_contact=mail($to,$subject,$content);
if($send_contact){
echo "Thank you!";
}
else {
echo "ERROR";
}
?>
I receive a mail but on the senders address (From) is written my e-mail address from the hosting server. If i add $headers ( i created the headers like this: " $headers = 'From: '.$field_email."\r
"; ") in the mail() than i dont receive any mail…
Please help…