While writing the code for your website using asp.net, you might want to send emails from your web application. You can configure the SMPT server to asp .net send email. For this, you can write the function directly in your ASP.NET coding. But this may be tricky if you wish to change the credentials. Each time you wish to change the credentials, you may have to make a lot of changes.
So the better alternative option for this would be to configure the SMPT server settings in the Web.config file. In the Web.config file, you have to specify the SMTP server in the host element, the port for the SMPT server, the email address and the password. Also, you have to enable SSL if your email server uses SSL.
A sample Web.config file is given below. This sample file uses the Gmail SMTP server and has the configurations to set up the Gmail SMTP server.