www.gibmonks.com

Main Page

  Previous Section Next Section

Chapter 27. The System.Web.Mail Namespace

The System.Web.Mail namespace allows you to send email messages from your ASP.NET application. This capability can use the built-in SMTP service included with IIS or an arbitrary SMTP server, and is similar to the CDO component used in traditional ASP development. The SMTP service in IIS maps its Inbox and Outbox to directories on the server. Message transfer is handled so that the Outbox is always empty and the Inbox never has an incoming queue. Note that in order to use these features, you must correctly configure the default SMTP server in IIS Manager so that it will relay messages to the Internet. If you do not take this step your mail will never be delivered, even though no exceptions will be raised in your code.

Messages and attachments are encapsulated in MailMessage and MailAttachment objects and sent using the SmtpMail helper class, which provides a single Send( ) method. Figure 27-1 shows the types in this namespace.

Figure 27-1. The System.Web.Mail namespace
figs/anet2_2701.gif
      Previous Section Next Section