Need to read my SMTP email settings defined under system.net section in my web.config file.
Below is one example of SMTP email setting defined in web.config file:
(Under Section)
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="testuser@domail.com">
<network defaultCredentials="true" host="localhost" port="25" userName="user” password="testPassword"/>
</smtp>
</mailSettings>
</system.net>
How to Access the SMTP Mail Setting by using c#
You can use the WebConfigurationManager: