Search code examples
phpsmtpgmailphpmailer

How to use PHPMailer, after 30 May 2022 when "Less secure app" is no longer an option?


I have been using PHPMailer for a long time to send emails using Google credentials (login and password) by enabling the "Less secure app" option in the Google settings.

As Google is notifying that after 30th May 2022, Google will not allow sending emails using the "Less secure app".

Less secure apps & your Google Account

enter image description here

Is there any other way to send emails using Gmail SMTP from PHPMailer without the "Less secure app" feature?


Solution

  • This ways work for me, you can try this :

    1. First go to your google account management and go to security.
    2. Make sure your 2-step verification are enabled.
    3. Then go to app password.
    4. Select other in the select app dropdown menu, and named whatever you like.
    5. And click generate, google will give you a password. make sure you copy it and save it somewhere else.
    6. instead using your real google account password in PHPMailer setting, use the password you just generate.