Server.Mail Property

Gets the Microsoft SQL Mail service associated with the instance of Microsoft SQL Server.

Namespace: Microsoft.SqlServer.Management.Smo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntax

'Declaration
Public ReadOnly Property Mail As SqlMail
public SqlMail Mail { get; }
public:
property SqlMail^ Mail {
    SqlMail^ get ();
}
/** @property */
public SqlMail get_Mail ()
public function get Mail () : SqlMail

Property Value

A SqlMail object that specifies the SQL Mail service associated with the instance of SQL Server.

Remarks

Updated text:

This namespace, class, or member is supported only in version 2.0 of the Microsoft .NET Framework.

Example

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server()
'Define the Database Mail service with a SqlMail object variable and reference it using the Server Mail property.
Dim sm As SqlMail
sm = srv.Mail
'Define and create a mail account by supplying the Database Mail service, name, description, display name, and email address arguments in the constructor.
Dim a As MailAccount
a = New MailAccount(sm, "AdventureWorks Administrator", "AdventureWorks Automated Mailer", "Mail account for administrative e-mail.", "dba@Adventure-Works.com")
a.Create()

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

Server Class
Server Members
Microsoft.SqlServer.Management.Smo Namespace

Other Resources

How to: Create a Database Mail Account by Using Visual Basic .NET
Using Database Mail
Setting Properties
Managing Servers

Change History

Release

History

New content:
  • Added code sample to the Example section.