Creating E-Mail Messages

In this section, we’ll talk about two ways to send e-mail messages. The first is simple, the second is more complicated but offers additional flexibility.

Creating Simple E-Mail Messages

Creating an e-mail is quite simple using the SmptMail object. Because the Send() method of the object is overloaded, it can take several variations of information. You can send an e-mail in two basic ways: pass all the components of an e-mail to the object separately, or pass it a MailMessage object. First look at passing separate components of an e-mail to the Send method by studying Listing 15.1.

Let’s first look at a VB example.

Listing 15.1. Visual Basic Example to Send Mail
 <%@ Import Namespace=”System.Web.Mail” %> <HTML> <head> ...

Get Special Edition Using® Microsoft® ASP.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.