Configure the Section of web.config
To send enquiry form emails from your ASP.NET website, you need to configure the
section of your web.config file with your SMTP server details.
Step-by-Step Instructions
- Open your website’s
web.configfile in a text editor. - Locate or add the
section. - Insert the
block with your SMTP details. - Substitute your own email address, domain, and password for the placeholders.
- Save the file and upload it to your website.
Example Configuration
<configuration>
<system.net>
<mailSettings>
<smtp from="email@yourdomain.com">
<network host="mail.yourdomain.com"
port="25"
userName="email@yourdomain.com"
password="youremailpassword"/>
</smtp>
</mailSettings>
</system.net>
</configuration>
Notes
-
Replace
email@yourdomain.comwith your actual email address. -
Replace
mail.yourdomain.comwith your actual mail server hostname (e.g.mail.plesk-secure.com). -
Replace
youremailpasswordwith the correct password for your email account. -
Port
25is shown here, but you may need to use465(SSL/TLS) or587(STARTTLS) depending on your server settings.
ℹ Tip: Always use SSL/TLS or STARTTLS if your mail server supports it, to keep your credentials secure.
✔ Recommended: Test your enquiry form after configuration to confirm emails are being sent successfully.