Sending email from ASP.Net 4 - C# sample code
February 8, 2010
posted by Brad Kingsley
Here at OrcsWeb our Managed Windows Hosting Solutions, paired with our famous Remarkable Service and Remarkable Support, go far beyond normal hosting. Sometimes we even assist our managed clients - both Managed Shared Hosting and Managed Dedicated Hosting - in troubleshooting and minor fixing of their code. A common request we see is for a sample of how to send an email from code so clients can integrate that function into their web site.
Below is sample code showing how to send email from ASP.Net 4 using C#. With this code I am assuming that the server already has a local SMTP service installed, so I use "localhost" to relay the email.
I realized the source code was mangled by the CMS and I didn't want a code sample sitting here that didn't work due to missing brackets. So I moved the code to another page that is complete and supports a straight copy/paste of the same code. Here's the link: http://bradkingsley.com/sending-email-from-asp-net-4-c-sample-code/
Since you are here on the site already, why not check out some of our solutions? Our Windows Cloud Server solution is our latest and extremely popular. We also have Managed Shared Hosting for small businesses, and Managed Physical Dedicated Server Hosting.













