0

My mailing functionality works by adding the configs on .env file.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=username
MAIL_PASSWORD=passwordd
MAIL_FROM=info@text.com
MAIL_NAME=Info

But my problem is I don't know how to update this configs dynamically. I've try using the helper config() but I can't see the SMTP values in config('app').

In case you're wondering why I want to do this is because the SMTP configs will come from the DB.

Dharman
  • 30,962
  • 25
  • 85
  • 135
kdlcruz
  • 1,368
  • 13
  • 20

1 Answers1

1

Perhaps you can use the Config::set method, as answered here:

Config::set('key', 'value');

https://stackoverflow.com/a/23438548/385402

but I think it would be better to use DB values directly before sending the email, I don't know if it makes sense that you store them into a config file at all if you already have them in the database.

Community
  • 1
  • 1
Glad To Help
  • 5,299
  • 4
  • 38
  • 56
  • That's the thing I don't know the exact key of Mail config that's why I can't use that method. Also, I don't intend to use the values from the config it's just how I do it now since I can't update them yet. – kdlcruz Oct 12 '15 at 10:19
  • After checking your link, I think I tried that already but I'll give a go right now. – kdlcruz Oct 12 '15 at 10:21
  • 1
    Wow, it works! I'm not sure what I did wrong yesterday. :(. Thank you! – kdlcruz Oct 12 '15 at 10:24