Skip to content
Advertisement

How could I set MAILER_DSN param in php code?

I need to set the MAILER_DSN variable with values that I have to take from the database. How can i do this? How can you override a .env file?

Advertisement

Answer

i dont know if Symfony has a Workaround for this, but I would do it that way

  1. Create a Event Listen for the first Kernel Event.
  2. In this Event override the $_SERVER[“MAILER_DSN”]

You can try it and give us a Feedback if it works for you.

Or you try to make your own EnvProcessor, that gets die Information from the Database.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement