framework: Mail (smtp): password and username not set in config

  • Laravel Version: 5.4.12
  • PHP Version: HipHop VM 3.18.1 (rel)
  • Database Driver & Version: Ver 15.1 Distrib 10.1.21-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Description:

If set in either config/mail.php, .env, or both, when using SMTP authentication over TLS or SSL, username and password are not set in config.

From a route, dd(Config::get('mail')); prints a configuration that misses username and password.

Steps To Reproduce:

Configure mail using either the global config/mail.php or .env file, eq.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=support@domain.com
MAIL_PASSWORD=...
MAIL_ENCRYPTION=tls

Open matching outgoing ports (465 for ssl or 587 for tls). Authentication to the smtp server should fail (error 530). Server reports credentials are not set.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (6 by maintainers)

Most upvoted comments

Fixed it by doing 'username' => env('MAIL_USERNAME','me@host.com') Rather than 'username' => env('me@host.com') in /config/mail.php

Guys, I’m fully on @maurocolella side. Confirming exact same f%%n problem on clean laravel v.5.1!

Solution:

MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_ENCRYPTION=tls SMTP_USERNAME=yyyy SMTP_PASSWORD=xxxx

dd(Config::get('mail')); returns correct credentials for me, can you please point me to the posts in forums where the same issue is reported?

The forums are full of people who report the same issue, and I am 100% certain my configs are not cached. I have a test route, I dd them in real-time, switch back and forth between tls and ssl, my configs are updated right before my eyes - and password and username are and remain null.

On Mar 1, 2017 23:17, “Mohamed Said” notifications@github.com wrote:

This doesn’t look as a framework issue to me, could be that your configs are cached. Please ask on the forums.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/laravel/framework/issues/18170#issuecomment-283368386, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuftAwSjZVpoZBRVYfPkQ1mHdVq9hqIks5rhYwEgaJpZM4MPOkZ .