Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 60,992 times

Contents

Downloads

Related Categories

SMTP Mailing Application - Introduction

Mike Gold

Introduction

This is an article on how to use the Mail Components in .NET to create a simple application to send e-mail. 

Figure 1 - The Smtp Mailing Application

The Smtp Mail functionality is contained in the System.Web.Mail namespace and contains three classes:

Table 1 - System.Web.Mail Namespace

System.Web.Mail Classes Description
SmtpMail Class used to send Mail via Windows 2000 SMTP services
MailMessage This class contains everything contained in an e-mail message. An instance of this can be sent by the SmtpMail class
MailAttachment This is a class representing an attachement to an email.

The SmtpMail Class gives you two static methods to send mail: the quick and easy way, and the more detailed way.

SmtpMail.Send(FromString, ToString, SubjectString, MessageString)

or

SmtpMail.Send(aMailMessage)

I opted to send email using the MailMessage object in this example because you can send a lot more information.  Some of the properties of the MailMessage Object are shown below:

MailMessage Property

Description

From who the email is from
To who the email is to
Cc who the email is copied to
Bcc who the email is copied to without seeing the recipients
Attachments A collection of Attachments to the email
Subject Subject of the email
Body Message Body of the email
BodyFormat The format of the Message Body (Currently Text or Html)
Priority MailPriority of the Message (High, Low, or Normal)

Table 2 - MailMessage Properties for an E-mail Message

Mike Gold is President of Microgold Software Inc. and Creator of WithClass 2000 a UML Design Tool for C#. In the last few years Mike has consulted for companies such as Merrill Lynch and Chase Manhattan Bank in New York.  He is been active in developing Visual C++ Applications for 10 years and looks forward to the possibilities in C#.

Mike Gold is President of Microgold Software Inc. and Creator of WithClass 2000 a UML Design Tool for C#. In the last few years Mike has consulted for companies such as Merrill Lynch and Chase Manhattan Bank in New York. He is been active in developing V

Comments

  • Posted by cicada on 07 Sep 2005

    Hi prazathin
    Not at all, good days

  • Posted by prazathin on 06 Sep 2005

    hi cicada
    Thank u

  • Posted by cicada on 05 Sep 2005

    and aspx page html part <%@ Import Namespace="System.Web.Mail" %>
    ok?

  • hi

    Posted by cicada on 05 Sep 2005