The email address and password is definitely correct. The script was working until yesterday. Now we receive the following error:
Mailer Error: SMTP connect() failed.
We can login to the Google email address. I can send emails via SMTP in Outlook. We have Google Apps Free Edition, so it is not possible to contact Google.
Does anyone have any ideas as to why the connection has just stopped working? Thank you.
mail->SMTPDebug = 2;
$mail->IsSMTP(true); // enable SMTP
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = $Username; // SMTP account username
$mail->Password = $Password;
$doc_dir = 'pdf/';
$mail->From = $From;
$mail->FromName = $FromName;
$mail->addAddress($email);
$mail->WordWrap = 50;
$mail->addAttachment($doc_dir.$FileName);
$mail->isHTML(true);
$mail->Subject = 'Your '.$warehouse_name.' Order Has Shipped';
$mail->Body = $Message;
$mail->AltBody = 'Racquet Depot UK';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
};