Sending Email in ASP .NET
I can't think of too many websites that don't send automated email. Unfortunately, for ASP .NET programmers, there are several incorrect and out-of-date code snippets online which try to explain how to send email.
Here's the code I use on the contact form for my personal website which does the trick quite nicely.
Here, I'm using MailMessage to build the actual email message to be sent and SmtpClient to do the actual sending.
Now, the Web.config file needs to be updated so the server knows your email account credentials.
Add this code to your Web.config file before the final </configuration> tag:
Now, you should be able to send automated email messages to your heart's content. Enjoy.