TechNet
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Server::Mail Property

 

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)

public:
[SfcObjectAttribute(SfcObjectRelationship::Object, SfcObjectCardinality::One)]
property SqlMail^ Mail {
	SqlMail^ get();
}

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.

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()
Return to top
Show:
© 2016 Microsoft