As I mentioned many times in the past, the old SmtpMail message objects in the System.Web namespace have been marked obsolete in ASP.NET 2.0. I have found a great site that will tell you everything you need to know about the mail object. Now, if you want to send e-mail, you should use the SmtpMail class in System.Net. This new class makes it a lot easier to do attachments and send multi-part messages.

Here is a simple example of sending out a message (remmeber to include System.Net)

//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("me@mycompany.com");
mail.To.Add("you@yourcompany.com");

//set the content
mail.Subject = "This is an email";
mail.Body = "this is a sample body";

//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);

Do you want to send out an HTML E-mail instead? That is simple, simply just set the IsBodyHtml property to true.

Sending out multi-part e-mails is pretty easy as well. Simply create new AlternateView objects and add them to the AlternateViews collection of the SmtpMail object as shown in the example below.

//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("me@mycompany.com");
mail.To.Add("you@yourcompany.com");

//set the content
mail.Subject = "This is an email";

//first we create the Plain Text part
AlternateView plainView = 
AlternateView.CreateAlternateViewFromString("This is my 
plain text content, viewable by those clients that don't 
support html", null, "text/plain");
//then we create the Html part
AlternateView htmlView = 
AlternateView.CreateAlternateViewFromString("this is 
bold text, and viewable by those mail clients that support 
html", null, "text/html");
mail.AlternateViews.Add(plainView);
mail.AlternateViews.Add(htmlView);

//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1"); 
//specify the mail server address
smtp.Send(mail);

There are a ton more examples and lots of additional information at this site below.

System.Net.Mail

Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=229