Configure Mail Settings in Web.Config

If you have a contact form that sends messages to email accounts, there is some extra configuration that you have to make so that it can work. In this article I will give give you a step-by-step guide on how to configure mail settings in Web.Config:

1. Open your ASP.Net project.

2. Then open the Web.Config file of your project:

webconfig-open-asp-tutorials

3. We are going to use three tag elements:

The <system.net> element which contains the specifics on how the .net framework connect to the network.

The <mailSettings> element lets you configure mail sending options.

The <smtp> element lets you configure the delivery method and the email address.

4. Look for the <configuration> section:

configuration-tag-webconfig-arvixe-asp-hosting

5. Add this code in the web.config file:

===================

<system.net>
<mailSettings>
<smtp from=”emailaccount@exampleemail.com”>
<network host=”smtp.exampleemail.com”
port=”25″
userName=”emailaccount@exampleemail.com”
password=”emailpassword”
enablessl=”false”/>
</smtp>
</mailSettings>
</system.net>

===================

6. Save your changes and that’s it! The email has been configured!

This concludes Configure Mail Settings in Web.Config 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *