I want little help. My contact form works fine , but why are my emails going into recipients' spam folders? Thank you in advance!
Here is my code:
<?php
$to = 'my_email@myhost.bg';
$date=date("l, F jS, Y");
$time=date("h:i A");
$subject=$_REQUEST['contact-subject'];
$type=$_REQUEST['type'];
$name=$_REQUEST['contact-name'];
$email=$_REQUEST['contact-email'];
$message=$_REQUEST['contact-messege'];
I guess its something wrong here, because the information about sender is too little
$msg = "";
$msg .= "Message sent from ZEUS website on date: $date, hour: $time.\n";
$msg .= "Sender name: $name\n";
$msg .= "Subject: $subject\n";
$msg .= "Sender Email: $email\n";
$msg .= "Sender Message: $message\n";
if($type == 'footer-newsletter') {
//Validate form from footer
if($_REQUEST['foot-news-email']=="") {
echo "<div class='alert alert-danger'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Warning!</strong> Please fill the Email field.
</div>";
} else {
mail($to,$subject,$msg,"From:".$email);
echo "<div class='alert alert-success'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Thank you!</strong>
</div>";
}
} else if($type == 'sidebar-newsletter') {
//Validate form from footer
if($_REQUEST['suscribe-email']=="") {
echo "<div class='alert alert-danger'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Warning!</strong> Please fill the Email field.
</div>";
} else {
mail($to,$subject,$msg,"From:".$email);
echo "<div class='alert alert-success'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Thank you!</strong>
</div>";
}
} else if($type == 'contact') {
//Validate form from footer
if($_REQUEST['contact-name']=="") {
echo "<div class='alert alert-danger'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Warning!</strong> Please fill the Name field.
</div>";
} else if($_REQUEST['contact-email']=="") {
echo "<div class='alert alert-danger'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Warning!</strong> Please fill the Email field.
</div>";
} else {
mail($to,$subject,$msg,"From:".$email);
echo "<div class='alert alert-success'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Thank you!</strong>
</div>";
}
} else if($type == 'comments') {
//Validate form from footer
if($_REQUEST['comments-name']=="") {
echo "<div class='alert alert-danger'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Warning!</strong> Please fill the Name field.
</div>";
} else if($_REQUEST['comments-email']=="") {
echo "<div class='alert alert-danger'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Warning!</strong> Please fill the Email field.
</div>";
} else {
mail($to,$subject,$msg,"From:".$email);
echo "<div class='alert alert-success'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Thank you!</strong>
</div>";
}
}
?>