
530
|
Chapter 27: The System.Web.Mail Namespace
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Hierarchy
System.Object ➝ System.ValueType ➝ System.Enum(System.IComparable, System.IFor-
mattable, System.IConvertible)
➝ MailPriority
Returned By
MailMessage.Priority
Passed To
MailMessage.Priority
SmtpMail
System.Web.Mail (system.web.dll)
class
The SmtpMail class represents the SMTP Server. It includes a static Send( ) method that
you can use to send email programmatically. There are two versions of the Send( )
method: one accepts a MailMessage object, and the other provides a quick and simple
way to send an email message without creating a MailMessage instance (by specifying the
sender’s email address, the recipient, the subject, and the body text as string parame-
ters). Before sending a message, set the static SmtpServer with the name of IP address of
the mail server (use “localhost” for the current computer).
High = 2
}
public class SmtpMail {
// Public Static Properties
public static string SmtpServer{set; get; }
// Public Static Methods
public static void Send( MailMessage message);
public static void Send(string from, string to, string subject, string messageText);
}