SendMailTask.SmtpConnection 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
SMTP(Simple Mail Transfer Protocol) 서버의 이름 또는 IP 주소를 가져오거나 설정합니다.
public:
property System::String ^ SmtpConnection { System::String ^ get(); void set(System::String ^ value); };
public string SmtpConnection { get; set; }
member this.SmtpConnection : string with get, set
Public Property SmtpConnection As String
속성 값
SMTP(Simple Mail Transfer Protocol) 서버의 이름 또는 IP 주소를 포함하는 문자열입니다.
구현
예제
다음 코드 샘플에서는 속성을 사용하는 SmtpConnection 새 SendMailTask 코드를 만들고 구성하고 실행합니다.
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.SendMailTask
Module Module1
Sub Main()
Dim pkg As New Package
Dim smtpCM As ConnectionManager
smtpCM = pkg.Connections.Add("SMTP")
smtpCM.Name = "SMTP Connection Manager"
smtpCM.ConnectionString = "smtphost"
Dim exe As Executable = pkg.Executables.Add("STOCK:SendMailTask")
Dim thSendMailTask As TaskHost = CType(exe, TaskHost)
With thSendMailTask
.Properties("SmtpConnection").SetValue(thSendMailTask, "SMTP Connection Manager")
.Properties("ToLine").SetValue(thSendMailTask, "someone1@example.com")
.Properties("CCLine").SetValue(thSendMailTask, "someone2@example.com")
.Properties("BCCLine").SetValue(thSendMailTask, "someone3@example.com")
.Properties("FromLine").SetValue(thSendMailTask, "someone4@example.com")
.Properties("Priority").SetValue(thSendMailTask, MailPriority.Normal)
.Properties("FileAttachments").SetValue(thSendMailTask, "C:\test_image.jpg")
.Properties("Subject").SetValue(thSendMailTask, "Testing the SendMail Task")
.Properties("MessageSourceType").SetValue(thSendMailTask, SendMailMessageSourceType.DirectInput)
.Properties("MessageSource").SetValue(thSendMailTask, "This is only a test.")
End With
Dim valResults As DTSExecResult = pkg.Validate(pkg.Connections, pkg.Variables, Nothing, Nothing)
If valResults = DTSExecResult.Success Then
pkg.Execute()
End If
End Sub
End Module
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.SendMailTask
Module TestSendMailTask
Sub Main()
Dim pkg As New Package
Dim smtpCM As ConnectionManager
smtpCM = pkg.Connections.Add("SMTP")
smtpCM.Name = "SMTP Connection Manager"
smtpCM.ConnectionString = "smtphost"
Dim exe As Executable = pkg.Executables.Add("STOCK:SendMailTask")
Dim thSendMailTask As TaskHost = CType(exe, TaskHost)
With thSendMailTask
.Properties("SmtpConnection").SetValue(thSendMailTask, "SMTP Connection Manager")
.Properties("ToLine").SetValue(thSendMailTask, "someone1@example.com")
.Properties("CCLine").SetValue(thSendMailTask, "someone2@example.com")
.Properties("BCCLine").SetValue(thSendMailTask, "someone3@example.com")
.Properties("FromLine").SetValue(thSendMailTask, "someone4@example.com")
.Properties("Priority").SetValue(thSendMailTask, MailPriority.Normal)
.Properties("FileAttachments").SetValue(thSendMailTask, "C:\test_image.jpg")
.Properties("Subject").SetValue(thSendMailTask, "Testing the SendMail Task")
.Properties("MessageSourceType").SetValue(thSendMailTask, SendMailMessageSourceType.DirectInput)
.Properties("MessageSource").SetValue(thSendMailTask, "This is only a test.")
End With
Dim valResults As DTSExecResult = pkg.Validate(pkg.Connections, pkg.Variables, Nothing, Nothing)
If valResults = DTSExecResult.Success Then
pkg.Execute()
End If
End Sub
End Module