Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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)

[SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)]
public SqlMail Mail { 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.

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