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
Hello, Umbracians.
I want to use settings from Web.config to make my little custom email-module work.
There is ConfigurationManager.GetSection("sectionName"), I tried input several paths, but it returns null anyway.
ConfigurationManager.GetSection("sectionName")
How to get it properly? Or, for my purpose: how to edit MailMessage properties that uses in library.SendMail()
library.SendMail()
SMTP settings aren't an Umbraco specific thing - they are a standard .NET setting. So you can access them directly from the SMTP client class.
So, add a reference to;
@using System.Net.Mail
Then you can go...
SmtpClient client = new SmtpClient(); string host = client.Host;
Use IntelliSense to see all the properties you can access on the client instance.
Docs: https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient
Hi, Dan
I knew about that class, but haven't knew about it scans configs right in constructor.
Many thanks! You saved my day
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to get smtp settings (<mailSettings>) from Web.config?
Hello, Umbracians.
I want to use settings from Web.config to make my little custom email-module work.
There is
ConfigurationManager.GetSection("sectionName")
, I tried input several paths, but it returns null anyway.How to get it properly? Or, for my purpose: how to edit MailMessage properties that uses in
library.SendMail()
SMTP settings aren't an Umbraco specific thing - they are a standard .NET setting. So you can access them directly from the SMTP client class.
So, add a reference to;
Then you can go...
Use IntelliSense to see all the properties you can access on the client instance.
Docs: https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient
Hi, Dan
I knew about that class, but haven't knew about it scans configs right in constructor.
Many thanks! You saved my day
is working on a reply...