Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How do I get smtp setting from the globalsettings in a surfacecontroller in umbraco v9 ?
If you look in the Umbraco source on GitHub, you can see that the GlobalSettings class has a property Smtp. You can read the settings from that object.
Smtp
In surface controllers you can use dependency injection, so you can simply add a constructor and pass the global settings in there like this:
public class MyController : SurfaceController { public MyController(IOptions<GlobalSettings> globalSettings) { ... } }
Kind regards, Dennis
Just a bit more information about the answer that was mentioned, as it helped me a lot. The Umbraco documentation can be found here. Configuration
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Access SMtp globalsettings in Surfacecontroller
How do I get smtp setting from the globalsettings in a surfacecontroller in umbraco v9 ?
If you look in the Umbraco source on GitHub, you can see that the GlobalSettings class has a property
Smtp
. You can read the settings from that object.In surface controllers you can use dependency injection, so you can simply add a constructor and pass the global settings in there like this:
Kind regards,
Dennis
Just a bit more information about the answer that was mentioned, as it helped me a lot. The Umbraco documentation can be found here. Configuration
is working on a reply...