I'm trying to fix this problem but struggle to. There is a very basic PHP contact form on the website and if I try with a personal address ****@gmail.com the emails are received. However, I don't receive the emails on *****@yahoo.co.uk neither on ********@mydomain.co.uk . I really don't know what could be the problem, I will leave the code down below:
// Website Contact Form Generator
// http://www.tele-pro.co.uk/scripts/contact_form/
// This script is free to use as long as you
// retain the credit link
// get posted data into local variables
$EmailTo = "angjeljanev@gmail.com";
$Subject = "Contact form";
$name = Trim(stripslashes($_POST['name']));
$email = Trim(stripslashes($_POST['email']));
$telephone = Trim(stripslashes($_POST['telephone']));
$enquiry = Trim(stripslashes($_POST['enquiry']));
/*SMTP authentication
$mail->SMTPAuth = true;
$mail->IsSMTP();
$mail->Host = "mail.londondoorstripping.co.uk"; // SMTP server
$mail->Username = "info@londondoorstripping.co.uk";
$mail->Password = "Doorstripping123";
$mail->SMTPSecure = 'tls';
$mail->Port = 25;
//------------------
*/
$target_dir = "contact/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check file size
if ($_FILES["fileToUpload"]["size"] > 900000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
// validation
$validationOK=true;
if (Trim($name)=="") $validationOK=false;
if (Trim($email)=="") $validationOK=false;
if (Trim($enquiry)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "www.londondoorstripping.co.uk/contact/". basename( $_FILES["fileToUpload"]["name"]);
$Body .= "\n";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Mobile number:";
$Body .= $telephone;
$Body .= "\n";
$Body .= "Email:";
$Body .= $email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $enquiry;
$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=thankyou.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?> ```