How to Resolve Mail Server Error Code 535: \'Username and Password not accepted\' with Gmail and SwiftMailer?

Patricia Arquette
Release: 2024-10-18 18:04:29
Original
701 people have browsed it

How to Resolve Mail Server Error Code 535:

Mail Server Error: "Username and Password not accepted" with Code 535

When attempting to send emails via Gmail using SwiftMailer, users may encounter the error message:

"Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted."

This issue can arise when Google suspects spam activity and temporarily restricts access to certain applications or devices. To resolve this, follow these steps:

1. Enable Two-Step Verification

Enable 2-step verification for your Google account to enhance security.

2. Create an App Password

Create an app password specific to your application or server. This password is different from your regular Google account password and should be used to access your Google account from third-party applications.

3. Update Environment File

Replace the original Gmail password in your environment file (e.g., .env) with the newly generated app password.

4. Restart the Server

Restart your Apache server or other application server to apply the changes.

Additional Tips:

  • Ensure that your email sending is not excessive and within Google's guidelines.
  • Avoid sending emails too quickly in succession, as this can trigger spam filters.
  • Consider using a different email provider or email sending service.

By following these steps, you can resolve the "Username and Password not accepted" error and resume sending emails through Gmail.

The above is the detailed content of How to Resolve Mail Server Error Code 535: \'Username and Password not accepted\' with Gmail and SwiftMailer?. For more information, please follow other related articles on the PHP Chinese website!

source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!