Ability to set ssl/tls for smtp in mail settings with environment variable #8989
-
DescriptionWe can currently set the smtp credentials, server and port all with environment variables. However, it appears the dropdown to select ssl vs tls for the connection is not able to be set to an environment variable. We are currently using mailtrap.io for testing environments and a proper transactional email service in production (although not one of the common ones). Mailtrap requires the connection be over tls (mail settings test fails when set to ssl), while production requires ssl. This wouldn't be quite such a problem except that we are enforcing project config (and have admin changes off in all non-local environments), and this setting is tracked in that. I'm hesitant to override the transport in config/app.php as in #5975 as it seems kind of invasive, especially seeing as all of the other fields in the smtp settings are configurable with environment variables. Is it possible to add support for configuring this in a way that project config is compatible with? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
Completely agree with this. We are using laradock with maildev for our dev environment and the most small websites still user smtp with tls for sending emails. Maildev breaks with tls setting on - controlling this via environment variables would be great. |
Beta Was this translation helpful? Give feedback.
-
Related: #6403 |
Beta Was this translation helpful? Give feedback.
-
This takes on new meaning with Nitro's support for MailHog. MailHog doesn't support authentication nor encryption but those cannot be set via environment variables.
|
Beta Was this translation helpful? Give feedback.
-
This would be a very nice addition indeed. We use mailhog locally which does not support authentication nor encryption (lika @ryanirelan) stated. For our staging and production environments we use postmark which requires you to use TLS encryption. Very annoying that we constantly have to switch between no encryption and TLS when we are testing locally vs staging. |
Beta Was this translation helpful? Give feedback.
-
Whilst I agree you should be able to set ALL mail settings via environment vars there is another way to get around this. In the components section of your app.php file you can do something like
|
Beta Was this translation helpful? Give feedback.
-
This is now resolved for the next Craft 3 release 🚀 See details at #10111 |
Beta Was this translation helpful? Give feedback.
This is now resolved for the next Craft 3 release 🚀
See details at #10111