Google SMTP has stopped working

The email address and password are definitely correct. The script was working until yesterday. We now receive the following error:

Mailer error: SMTP connect () failed.

We can log into the Google email address. I can send emails via SMTP in Outlook. We have a free version of Google Apps, so it's not possible to contact Google.

Does anyone have any ideas as to why the connection just stopped working? Thank.

  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;
      };

      

+3


source to share


1 answer


The host made an SMTP restriction that caused the problem. Otherwise, the code will be correct.



0


source







All Articles