Mail Class

A wrapper class to the MailMessage class that simplifies sending mail messages.

Definition

Namespace: Gemstone.Net.Smtp
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.128 -- Release Build+d050cfc5563c89a1188cc3c6b2d417530856f490
public class Mail : IDisposable
Inheritance
Object    Mail
Implements
IDisposable

Example

This example shows how to send an email message with attachment:
C#
using System;
using Gemstone.Net.Smtp;

class Program
{
    static void Main(string[] args)
    {
        Mail email = new Mail("sender@email.com", "recipient@email.com", "smtp.email.com");
        email.Subject = "Test Message";
        email.Body = "This is a test message.";
        email.IsBodyHtml = true;
        email.Attachments = @"c:\attachment.txt";
        email.Send();
        email.Dispose();

        Console.ReadLine();
    }
}

Constructors

Mail Initializes a new instance of the Mail class.
Mail(String) Initializes a new instance of the Mail class.
Mail(String, String) Initializes a new instance of the Mail class.
Mail(String, String, String) Initializes a new instance of the Mail class.

Properties

Attachments Gets or sets the comma-separated or semicolon-separated list of file names to be attached to the Mail message.
BccRecipients Gets or sets the comma-separated or semicolon-separated e-mail address list of the Mail message blank carbon copy (BCC) recipients.
Body Gets or sets the body of the Mail message.
CcRecipients Gets or sets the comma-separated or semicolon-separated e-mail address list of the Mail message carbon copy (CC) recipients.
Client Gets the SmtpClient object used for sending the Mail message.
EnableSSL Gets or sets the flag that determines whether to use SSL when communicating with the SMTP server.
From Gets or sets the e-mail address of the Mail message sender.
IsBodyHtml Gets or sets a boolean value that indicating whether the Mail message Body is to be formatted as HTML.
Password Gets or sets the password used to authenticate to the SMTP server.
SecurePassword Gets or sets the password used to authenticate to the SMTP server.
SmtpServer Gets or sets the name or IP address of the SMTP server to be used for sending the Mail message.
Subject Gets or sets the subject of the Mail message.
ToRecipients Gets or sets the comma-separated or semicolon-separated e-mail address list of the Mail message recipients.
UserName Gets or sets the username used to authenticate to the SMTP server.

Methods

Dispose Releases all the resources used by the Mail object.
Dispose(Boolean) Releases the unmanaged resources used by the Mail object and optionally releases the managed resources.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize Releases the unmanaged resources before the Mail object is reclaimed by GC.
(Overrides ObjectFinalize)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Send Send the Mail message with Attachments to the ToRecipients, CcRecipients and BccRecipients using the specified SmtpServer.
Send(String, String, String, String, Boolean, String) Sends a Mail message.
Send(String, String, String, String, Boolean, String, String) Sends a Mail message.
Send(String, String, String, String, Boolean, String, String, SecureString) Sends a secure Mail message.
Send(String, String, String, String, Boolean, String, String, String) Sends a secure Mail message.
Send(String, String, String, String, String, String, Boolean, String) Sends a Mail message.
Send(String, String, String, String, Boolean, String, String, SecureString, Boolean) Sends a secure Mail message.
Send(String, String, String, String, Boolean, String, String, String, Boolean) Sends a secure Mail message.
Send(String, String, String, String, String, String, Boolean, String, String) Sends a Mail message.
ToStringReturns a string that represents the current object.
(Inherited from Object)

Fields

DefaultSmtpServer Default SmtpServer to be used if one is not specified.

Extension Methods

GetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
GetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)

See Also