SendMailMessageSourceType 列挙体

電子メール メッセージの本文を含むまたは本文を指す MessageSource プロパティの種類を指定します。

名前空間:  Microsoft.SqlServer.Dts.Tasks.SendMailTask
アセンブリ:  Microsoft.SqlServer.SendMailTask (Microsoft.SqlServer.SendMailTask.dll)

構文

'宣言
Public Enumeration SendMailMessageSourceType
'使用
Dim instance As SendMailMessageSourceType
public enum SendMailMessageSourceType
public enum class SendMailMessageSourceType
type SendMailMessageSourceType
public enum SendMailMessageSourceType

メンバー

メンバー名 説明
DirectInput メッセージ ソースが MessageSource プロパティにテキストとして含まれることを指定します。
FileConnection メッセージ ソースが MessageSource プロパティにファイルとして含まれることを指定します。
Variable メッセージ ソースが MessageSource プロパティに変数として含まれることを指定します。

使用例

次のコード サンプルでは、SendMailMessageSourceType 列挙を使用する新しい SendMailTask を作成します。

using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.SendMailTask;

class Program
{
  static void Main(string[] args)
  {
    Package pkg = new Package();
    ConnectionManager smtpCM;
    smtpCM = pkg.Connections.Add("SMTP");
    smtpCM.Name = "SMTP Connection Manager";
    smtpCM.ConnectionString = "smtphost";
    Executable exe = pkg.Executables.Add("STOCK:SendMailTask");
    TaskHost thSendMailTask = ((TaskHost)(exe));
    thSendMailTask.Properties["SmtpConnection"].SetValue(thSendMailTask, "SMTP Connection Manager");
    thSendMailTask.Properties["ToLine"].SetValue(thSendMailTask, "someone1@example.com");
    thSendMailTask.Properties["CCLine"].SetValue(thSendMailTask, "someone2@example.com");
    thSendMailTask.Properties["BCCLine"].SetValue(thSendMailTask, "someone3@example.com");
    thSendMailTask.Properties["FromLine"].SetValue(thSendMailTask, "someone4@example.com");
    thSendMailTask.Properties["Priority"].SetValue(thSendMailTask, MailPriority.Normal);
    thSendMailTask.Properties["FileAttachments"].SetValue(thSendMailTask, "C:\\test_image.jpg");
    thSendMailTask.Properties["Subject"].SetValue(thSendMailTask, "Testing the SendMail Task");
    thSendMailTask.Properties["MessageSourceType"].SetValue(thSendMailTask, SendMailMessageSourceType.DirectInput);
    thSendMailTask.Properties["MessageSource"].SetValue(thSendMailTask, "This is only a test.");
    DTSExecResult valResults = pkg.Validate(pkg.Connections, pkg.Variables, null, null);
    if (valResults == DTSExecResult.Success)
    {
      pkg.Execute();
    }
  }
}
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

関連項目

参照

Microsoft.SqlServer.Dts.Tasks.SendMailTask 名前空間