The error message you provided, “Invalid login: 534-5.7.9 Application-specific password required,” indicates an issue with the login credentials or authentication method you are using for the Gmail SMTP server.
Here are a few steps you can take to address the problem:
- Enable “Less Secure Apps” access: In some cases, you may need to enable “Less Secure Apps” access in your Google account settings to allow the application to send emails using SMTP. To do this, go to your Google Account settings, navigate to the “Security” tab, and enable the “Less secure app access” option. Keep in mind that enabling this option may pose some security risks, so use it cautiously.
- Generate and use an application-specific password: If you have enabled two-factor authentication (2FA) for your Google account, you cannot use your regular account password for SMTP authentication. Instead, you need to generate an application-specific password to authenticate with the Gmail SMTP server. Follow these steps:
- Visit the Google Account security page (https://myaccount.google.com/security).
- Under the “Signing in to Google” section, click on “App passwords” (you may need to verify your identity).
- Generate an application-specific password for the “Mail” app or any other app you are using to send emails.
- Copy the generated password and use it as the password in your email sending code instead of your regular Google account password.
- Consider using a different SMTP provider: If you continue to experience issues with Gmail SMTP, you may consider using a different SMTP provider that does not have the same restrictions or provides more flexible authentication options. Some popular alternatives include SendGrid, Mailgun, and SMTP servers provided by your hosting provider.
Make sure to update your email sending code with the correct login credentials or application-specific password based on the above steps.
Very good information. Lucky me I found your blog by chance (stumbleupon). I have bookmarked it for later!
I like it whenever people get together and share thoughts. Great website, keep it up!