Hi,
Is it possible to configure the SMTP server information and credentials on the settings.php or any configuration file. This helps in automation deployment to different environments.
Hi,
Is it possible to configure the SMTP server information and credentials on the settings.php or any configuration file. This helps in automation deployment to different environments.
Comments
Comment #2
webflo commentedYou can use "Global overrides" to override the swiftmailer settings. Please read the docs on https://www.drupal.org/docs/8/api/configuration-api/configuration-overri...
Comment #3
webflo commentedComment #4
webflo commentedComment #6
ralkeon commentedHi all, I'm trying to override swiftmailer configuration in the settings.php file but with no luck.
I use
but still have values I set from drupal interface... (already cleared cache, nothing happen).
Someone had the same issue?
Thanks for any advise.
Comment #7
uziel.bueno commentedYou can override swiftmailer configuration with these lines in your settings.php:
The only disadvantage of this method is that you won't be able to see the actual configuration values in the Swiftmailer configuration form.
If you want to check what value a configuration key has, you can run this Drush command:
Comment #8
ralkeon commentedUhm... Thanks for the tip but is still not working :(
in the same settings.php file I've this code
but when I run
I still get the configuration I saved by drupal config interface.
Comment #9
uziel.bueno commentedHave you tried rebuilding the cache?
Comment #10
ralkeon commentedYep, I tried rebuilding the cache and also set all cache config to false/null, no luck. It's not that great issue because it's working by set config from interface but I always have to check what I'm exporting and pushing on my repo :D
Comment #11
scott.whittaker commentedSorry to necro a closed issue, but this is still an issue.
$config['swiftmailer.transport']['smtp_host'] = 'mailhog';This seems to be the correct pathing for this setting but adding this to settings.php has no effect.
drush config:set swiftmailer.transport smtp_host mailhogworks but using automatic site-specific config would be safer and easier. Do we know why it doesn't work?Comment #12
Michael Zetterberg fd. Lopez commentedHave you tried sending a test e-mail with the overrides in place? You can do so at
/admin/config/swiftmailer/testFor me with Drupal 8.9.7 and Swiftmailer 2.0.0-beta1 it works as advertised as per docs at https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-... like webflo said.
So basically adding
--include-overriddento the command is what you are looking for.gives the "Drupal administration interface" value (I have sendmail set in the admin UI)
Running
gives the "overriden" value (I have smtp set in settings.local.php which is conditionally included if it exists in settigs.php)
Sending a test e-mail shows up in mailhog as it should.