Configuring .NET Mail Settings Within a web.config File

Configuring .NET Mail Settings within a web.config File

Configuring your site to send mail with .NET is essential for any contact form, or notification that you would like your website to automatically send.  In order to use .NET to send out email with out mail servers you will need to update your web.config file.

web.config Code

First you will need to open your web.config file in a text editor of your choice.  The following code must be added to your web.config file:

<smtp from="">
<network host="" />

Please Note: The smtp from field will need to be changed to a valid email address for your domain in order to authenticate your domain name to our mail servers. The host field will need to be changed to the mail server for your account.  Your mail server is the same as the MX record located in your DNS settings.  To find your DNS settings please use the appropriate Knowledge Base article below:
WebControlCenter Customers: KB 243
cPanel Customers: KB 1740
Plesk Customers: KB 1741

With this script you will not need to specify the SMTP port, username and/or password in the settings as the webserver will have access to send the email through the mail server.

Add Feedback