Tuesday, 9 September 2014

DNN: Get SMTP Settings from DotNetNuke

In your module, if you need to access to the SMTP settings specified in the HOST settings of the DNN portal, you can use the following function to retrieve it and use it in your code.

You can pass the following parameters in the function to retrieved the required setting value

- SMTPAuthentication
- SMTPPassword
- SMTPServer
- SMTPUsername

var hostSettings = DotNetNuke.Entities.Host.Host.GetHostSettingsDictionary();
string SMTPServer = hostSettings["SMTPServer"];
string SMTPAuthentication = hostSettings["SMTPAuthentication"];


This post is from my old blog posted on May 2012, that unfortunately no longer exist.


Post a Comment