Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Bradley James Ahrens's avatar

Failed to authenticate on SMTP server with username "[email protected]" using 2 possible authenticators

Hey guys,

I have an application that sends out emails. Everything was working fine until I connected this email address to my Gmail account in order to have easier access to it and to be able to reply to users.

Now I'm getting an error on the site:

(1/1) Swift_TransportException

Failed to authenticate on SMTP server with username "[email protected]" using 2 possible authenticators.

I have tried the following to fix this problem:

  • I have checked all of the mail settings and they are all correct.
MAIL_DRIVER=smtp
MAIL_HOST=mydoma.in
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=mysupersecretpassword
MAIL_ENCRYPTION=ssl
  • I have SSHed in and tried clearing the cache:
php artisan config:cache
php artisan config:clear

Any idea what else it could be?

Thanks guys!

0 likes
9 replies
ejdelmonico's avatar
Level 53

If you have 2-step verification on your gmail, it will cause many troubles so I would advise using a service like Mailgun to relay your transactional emails. You can have the mail sent to your gmail. Otherwise, the only way you can do it consistently is to check the box in gmail settings to allow 3rd party apps or something like that. I forget the exact wording to allow it...but it is unreliable at best.

1 like
ejdelmonico's avatar

@almost_pitt Yes, that is the wording I meant. I just couldn't remember. I have tried in the past to use gmail directly and had too many issues. Once I switched to Mailgun, it just works and really easy to configure in Laravel. Also, if still trying to use it directly and 2-step is on, make sure you make and use an app password.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=apppassword
MAIL_ENCRYPTION=tls

And don't forget to clear the config cache.

1 like
Mario Nava's avatar

I tried with gmail but it's imposibble. Mailgun works perfect!

wazirhashmi@yahoo.com's avatar

MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=wazirk217@gmail.com MAIL_PASSWORD=qyzfygnufnkvutss // its you app password not original of gmail pass MAIL_ENCRYPTION=tls

cyperIN's avatar

It worked for me to create another email and put your credentials

Please or to participate in this conversation.