Server.Mail Property

 

Applies To: SQL Server 2016 Preview

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

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

Syntax

[SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)]
public SqlMail Mail { get; }
public:
[SfcObjectAttribute(SfcObjectRelationship::Object, SfcObjectCardinality::One)]
property SqlMail^ Mail {
    SqlMail^ get();
}
[<SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)>]
member Mail : SqlMail with get
<SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)>
Public ReadOnly Property Mail As SqlMail

Property Value

Type: Microsoft.SqlServer.Management.Smo.Mail.SqlMail

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

Examples

Legacy Code Example

Visual Basic

Code snippet is not found. Confirm that the code snippet name 'SMO How to' is correct.

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()

See Also

Server Class
Microsoft.SqlServer.Management.Smo Namespace
Using Database Mail
Setting Properties

Unable to find linked topic '776ac273-bbe5-45e2-8bc8-a6f2b9cac03a'.

Return to top