The following code does not work once i put it on the server, I have similar code working on my local environment and it works perfectly, any ideas?
edit: i did set my gmail setting to "less secure"
<?php
$setid = $_POST['setid'];
$promo = $_POST['promo'];
echo "Good Sir, your set ID is ".$setid.", and you are eligible for the following deal:";
echo "<br><br>";
echo $promo;
$message= "Good Sir, your set ID is ".$setid.", and you are eligible for the following deal:"."<br><br>".$promo;
require "phpmailer/class.phpmailer.php";
// Instantiate Class
$mail = new PHPMailer();
// Set up SMTP
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Encoding = '7bit';
// Authentication
$mail->Username = "xxx@example.com";
$mail->Password = "mypass";
// Compose
$mail->SetFrom("jghh@ghh.ca");
$mail->AddReplyTo("ghh@ghh.ca");
$mail->Subject = "TryIt";
$mail->MsgHTML($message);
// Send To
$mail->AddAddress("receiver@hotmail.com", "Recipient Name");
$result = $mail->Send();
$message = $result ? 'Successfully Sent!' : 'Sending Failed!';
unset($mail);
?>
This is what I get in Network -> Preview:
Good Sir, your set ID is 100065, and you are eligible for the following deal:
Current Promotion: Enjoy 15% discount on your next visit!SMTP Error: Could not authenticate.