Can anyone inform me about how to correctly send mail from a contact form so it will be received in my inbox instead of the funk folder?
<?php
$EmailFrom = "myhost@email.nl";
$EmailTo = "myemail@address.com";
$Subject = "Mail via mydomain.nl";
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Naam: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Bericht: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$Email>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
This is the code i've got so far. It 'trims' the input from the HTML, throws this in the $body variable.
How do i make the mail look safe to my inbox? $headers? :)