I used godaddy hosting for my website. I tried to send the contact form fill to my personal gmail and it worked (send as a spam). If I change it to my website email, it said successfully send but there's none in the inbox. (the code below is suggested by godaddy)
I used zoho mail for my website email and I also tried using their configuration (their host and tsl security), but it didn't work. There's always "https://github.com/PHPMailer/PHPMailer/wiki/troubleshooting" popup when I tried to send the contact form filling source
$mail = new PHPMailer();
//If you don't receive the email, enable and configure these parameters below:
$mail->IsSMTP();
$mail->Mailer='smtp';
$mail->SMTPAuth = false;
$mail->SMTPAutoTLS = false;
//$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to 587 or 465
$mail->Host = 'localhost'; // Specify main and backup SMTP servers, example: smtp1.example.com;smtp2.example.com
$mail->Username = 'support@domain.com'; // SMTP username
$mail->Password = 'xxxx'; // SMTP password
$mail->SMTPOptions = array('ssl' => array('verify_peer' => false,'verify_peer_name' => false,'allow_self_signed' => true));
$mail->CharSet = 'UTF-8';
$mail->From = $email;
$mail->FromName = $name;
if(strpos($to, ',') !== false){
$email_addresses = explode(',', $to);
foreach($email_addresses as $email_address) {
$mail->AddAddress(trim($email_address));
}
}
else {$mail->AddAddress($to);}
$mail->AddReplyTo($email, $name);
$mail->Subject = $subject;
$mail->isHTML(true);