Server.Mail Server.Mail Server.Mail Property

Definition

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

public:
 property Microsoft::SqlServer::Management::Smo::Mail::SqlMail ^ Mail { Microsoft::SqlServer::Management::Smo::Mail::SqlMail ^ get(); };
[Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcObject(Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcObjectRelationship.Object, Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcObjectCardinality.One)]
public Microsoft.SqlServer.Management.Smo.Mail.SqlMail Mail { get; }
Public ReadOnly Property Mail As SqlMail
Property Value

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

Examples

Visual Basic

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$sm = $srv.Mail  
$a = new-object Microsoft.SqlServer.Management.Smo.Mail.MailAccount($sm, "Adventure Works Administrator", "AdventureWorks2012 Automated Mailer", "Mail account for administrative e-mail.", "dba@Adventure-Works.com")  
$a.Create()  

Applies to