Created by: Hamish Taplin ([email protected]) on 2015/03/11 12:03:00 +0000
Votes at time of UserVoice import: 45
Currently, it's not possible to defined environment-specific email settings. This makes things difficult if you want to test emails with a service such as MailTrap.
Being able to define email settings in your config would makes things much more flexible.
+1
+1 Config, config, config!
+1
Please, please, please. My clients don’t want us running test emails through their system, but changing settings between staging and production after pushing either way is irritating at best.
+1. Config file for all config whenever possible.
+1 for this. It almost seems like an oversight that there's not a config setting for this already. Hope one gets added soon. Nice to be able to have all settings that change on a per-site basis like this in a single config file.
given so much else can be defined in config, this would be a great addition.
This is possible in Craft 3 via config/app.php: https://github.com/craftcms/docs/blob/master/en/configuration.md#mailer-component
Now here: https://docs.craftcms.com/v3/config/#mailer-component
@brandonkelly Is the documentation up to date? The referenced method is deprecated and I cannot get this to work.
@joshuabaker Just updated that example to use the new method, but the old one will still work. One caveat with customizing the Mailer component from config/app.php is that those changes won’t be used when you test email settings from Settings → Email. (I also just updated the docs with a tip about that.) Is that where you’re finding that it’s not working?
@brandonkelly Thanks for clarifying. I was indeed using the test function.
Is it hugely complex to get this working with the test email function? I think it’ll be confusing to be unable to see the final config on that page and be unable to test it.
In an ideal world, it’d be good to have settings from a config/mailer.php config file merge into the component. That’d be cleaner from a multi-environment perspective.
That’s not possible, unfortunately. Though you can “test” your settings by creating a new user account with an email address you have access to, and check if the activation email reaches you.