Accessing Web.Config File SMTP Mail Settings Programmatically

I needed to read my SMTP email settings defined under system.net section in my web.config file. In order to use eNewsLetter and other SiteAdmin CMS modules that sending email notifications; you can setup your web.config to defind SMTP services settings.

Below is one example of SMTP email setting defined in web.config file:
(Under <configuration> Section)

<system.net>
<mailSettings>
<smtp deliveryMethod=”Network” from=”testuser@domail.com”>
<network defaultCredentials=”true” host=”localhost” port=”25″ userName=”kaushal” password=”testPassword”/>
</smtp>
</mailSettings>
</system.net>

To Access, this SMTP Mail Setting Programatically, you need to import below namespaces:

Read More…

Follow

Get every new post delivered to your Inbox.