0

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\">";
}
?> ```
  • It's probably not the code, if you did your job correctly, it's the receiving end that's problem. All mailboxes have spam filters, and all filters are different. You need to see what you need to do to comply with these filters. Look for things like SPF, DKIM, DMARC, and so on. – KIKO Software Dec 05 '21 at 12:04
  • Check if yahoo or domain extantions .co.uk is not disabled by your hosting company. –  Dec 05 '21 at 12:13
  • Most likely because the mail server you are sending from does not have permission to use those from addresses. I expect you will see more info about what is happening to those messages if you look in your mail server's log file. Could also try setting the submitter's address as a reply-to instead of a from address. You get much more control over all this if you use PHPMailer. – Synchro Dec 05 '21 at 12:30

0 Answers0