-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OrchardCore.Email settings in appsettings.json not used #4611
Comments
Let me check .. |
Seems the options came from the |
Thanks @hishamco . Appreciate the help with this! |
I already start working on this, after that went to some localization stuff .. coming back to this :) |
We should check this from a design perspective (and I'm not saying it's a bad idea, just that we should check) As far as I know, at the moment configuring anything is done either through I don't think there are any places were we support configuring something through both techniques. Not against it, but if we do it for email, then we have to do it for media settings, azure, data protection etc. We would also need to make a choice about which overrides the other, if both are configured. Does appsettings win, or do database settings win? |
@mattcrossmarc Your mitigation here, in case it isn't clear, is to enable the Email Module / Feature, and configure it through site settings, in the admin |
You 're right
IMHO |
Thanks guys. If you decide not to support appsettings for SMTP, it would be good to remove the example from the doc and OrchardCore.Csm.Web/appsettings.json. Those are what led me to try it: https://orchardcore.readthedocs.io/en/dev/OrchardCore.Modules/OrchardCore.Email/#smtp-settings My vote would be to support both options. In my development, I find myself frequently deleting App_Data and restarting from my custom recipe file. While I can (and have) included most SMTP settings in the recipe file, I can't bring myself to put Username and Password in source control, even for a test account. So, I have to reconfigure these every time I publish the site. The nice thing about the ASP.NET configuration system is I can use User Secrets for local development and other options for test and prod environments so I don't have to store secrets in code. In my case, I'm using AWS Parameter Store, but it's easy enough to pull them from where ever by building a custom provider. My general preference (although I understand it may take some iterating to get there) would be for site settings to be exposed as part of the ASP.NET configuration system as well. That way, there is one way to read config settings in code, whether stored in the database or elsewhere. Also, it allows for fairly simple changes to precedent by changing the order of the configuration providers. Out of the box, I think it would probably make most sense to OrchardCore administrators if the settings they can see in Admin take precedent over any settings read from appsettings.json or otherwise. That way, if they need to change the values in a running environment, they can use the nice Admin experience to do that rather than calling on someone to change settings elsewhere. |
@mattcrossmarc Wanted to give you an update on this to clear any confusion. But you make a compelling argument above, so here is my counter argument :) Configuration, and UI Settings are currently 2 separate areas of concerns, and quite loosely connected. The loose connection is made with the So most anything that is loaded via Or anything that is set by the UI Settings (Site settings), is also then registered against an The So the way to achieve what you were wanting to do, which is configure email from This is also the way aspnetcore configures things, and how you change aspnetcore Does this work for you? If you have alternate views, please feel free to re-open |
@deanmarcussen Thanks for the update and for the guidance on implementing it myself. I think this will work just fine for me. Appreciate you all giving this so much consideration and offering an alternative. Matt |
If I uncomment and configure the "OrchardCore.Email" settings in appsettings.json for OrchardCore.Cms.Web, the settings appear to never be used. For example, if I enable the Users Registration feature, when I attempt to navigate to the register page, the SmtpService is resolved, but the IOptions instance injected at construction does not have these values.
Here are the settings from appsettings.json, with sensitive values masked:
Is this still supported as a configuration option for SMTP settings.
Thanks,
Matt
The text was updated successfully, but these errors were encountered: