How to send email from gmail via phpmailer after less secure apps are closed by gmail.

how to connect cpanels database
How to connect Cpanels database in localhost (PHP and Laravel).
July 2, 2022
How to Install new Laravel setup in local Computer
How to Install new Laravel setup in local Computer
July 8, 2022
Show all

How to send email from gmail via phpmailer after less secure apps are closed by gmail.

How to send email from gmail via phpmailer

Send an email with Gmail in Laravel & PHP Framework via PHPMailer, After the “less secure app” option is no longer supported via Google.

After 30th May 2022 Gmail changed the policy regarding the option “Less secure apps & your Google Account” This setting is no longer available. PHPMailer is stopped sending emails. Gmail SMTP server stopped working as it no longer support “Less Secure Apps”
send email from gmail via phpmailer-
Very simple to send the email. To send an email again you need to follow these steps:

  1. Login to your Gmail account e.g. myaccount.google.com
  2. Go to Security settings.
  3. Enable 2 factors (step) authentication.
  4. After enabling this you can see the app passwords option. Click here!
  5. And then, from the Your app passwords tab select the “Other option” and put your app name and click GENERATE button to get a new app password.
  6. Finally copy the 16 digits password and click done. Now use this password instead of an email password to send mail via your app.
  7. Now you can use email and this generated pass to send the email.
  8. The setting of the email configuration would be as follows
    • Method 1:
      • MAIL_DRIVER=smtp
      • MAIL_HOST=smtp.gmail.com
      • MAIL_PORT=587
      • MAIL_ENCRYPTION=tls
      • MAIL_USERNAME=example@gmail.com
      • MAIL_PASSWORD=myPass (this should be the app password)
    • Method 2:
      • MAIL_DRIVER=smtp
      • MAIL_HOST=smtp.googlemail.com
      • MAIL_PORT=465
      • MAIL_ENCRYPTION=ssl
      • MAIL_ADDRESS=example@gmail.com
      • MAIL_PASSWORD=myPass (this should be the app password)

Leave a Reply

Your email address will not be published. Required fields are marked *

× How can I help you?
//]]>