How Do I?

[How Do I:] Implement Error Handling when Sending Email with ASP.NET

By Chris Pels|24 minutes|
Chris Pels shows how to implement error handling when sending an email with ASP.NET. He creates an ASP.NET web page to send email, shows how to configure in the web.config file, describes the System.Net.Mail class and how it’s used to create and send email messages. He then adds error handling using System.Net.Mail exception classes, which provide information about errors that can occur when sending email, and reviews the SmtpStatusCode enumeration, which provides a list of possible outcomes when sending an email with the SmtpClient. Finally, he sends a test email that raises an exception and reviews the error handling information in the Visual Studio debugger.

DOWNLOADS: Code (C#)|Code (VB)|MP3|MP4|WMV

This article was originally created on November 6, 2008

Author Information

Chris Pels

Chris Pels – Chris has been instrumental in the architecture, development, and implementation of a wide variety of business systems and databases as a technology consultant since 1986. He has extensive experience in business analysis, technical specifications, database design, several programming languages including C# and VB.NET, and statistical analysis. He holds a Ph.D. from The University of Michigan and has been a speaker at Microsoft TechEd, Microsoft DevDays, VSLive, numerous events in New England