Server.Mail 속성

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

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

구문

‘선언
<SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)> _
Public ReadOnly Property Mail As SqlMail 
    Get
‘사용 방법
Dim instance As Server 
Dim value As SqlMail 

value = instance.Mail
[SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)]
public SqlMail Mail { get; }
[SfcObjectAttribute(SfcObjectRelationship::Object, SfcObjectCardinality::One)]
public:
property SqlMail^ Mail {
    SqlMail^ get ();
}
[<SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)>]
member Mail : SqlMail
function get Mail () : SqlMail

속성 값

유형: Microsoft.SqlServer.Management.Smo.Mail.SqlMail
A SqlMail object that specifies the SQL Mail service associated with the instance of SQL Server.

Visual Basic

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

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

참고 항목

참조

Server 클래스

Microsoft.SqlServer.Management.Smo 네임스페이스

관련 자료

데이터베이스 메일 사용

속성 설정

서버 관리