Has anyone used "Perfect Contact Us Form" by forest_of_code/PerfectCode?
I keep getting the error: "Oops! Something not right. Please check your details."
I followed the coder's instructions step by step and checked multiple times that I have not mistyped soemthing. I am also sure that my host allows mail over SMTP. I am trying to send mail using the gmail smtp. I enabled "allow less secure apps" on my account and i am not using 2AuthFactor.
These are my current Settings (the XXXX are to hide my info, in my files im using my actual info):
function smtpContact($to, $subject, $name, $phone, $message){
require_once 'PHPMailer/PHPMailerAutoload.php';
$response = array();
//Create a new PHPMailer instance
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = "XXXXXX@gmail.com";
$mail->Password = "xxxxxxxxxxxxx";
$mail->setFrom($to, $name);
$mail->addAddress('XXXXXXXX@gmail.com', 'XXXXX');
$mail->Subject = $subject;
$message = '<div style="background:#F5F5F5; padding:10px;">
<p>'.$message.'</p><br />
<div>Name : '.$name.'</div><br />
<div>Phone : '.$phone.'</div><br />
</div>';
$mail->msgHTML($message);
$mail->AltBody = 'This is a plain-text message body';
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
if (!$mail->send()){
// For Debugging
//return "Mailer Error: " . $mail->ErrorInfo;
$response['error'] = 'Something not right. Please check your details.';
}else{
$response['success'] = 'Your email has been sent successfully.';
}
echo json_encode($response, JSON_PRETTY_PRINT);
}/*...ends[contactus]...*/