SendMailTask.MessageSourceType Property

Gets or sets a value containing the source type of the message body.

Namespace: Microsoft.SqlServer.Dts.Tasks.SendMailTask
Assembly: Microsoft.SqlServer.SendMailTask (in microsoft.sqlserver.sendmailtask.dll)

Syntax

'Declaration
Public Property MessageSourceType As SendMailMessageSourceType
public SendMailMessageSourceType MessageSourceType { get; set; }
public:
virtual property SendMailMessageSourceType MessageSourceType {
    SendMailMessageSourceType get () sealed;
    void set (SendMailMessageSourceType value) sealed;
}
/** @property */
public final SendMailMessageSourceType get_MessageSourceType ()

/** @property */
public final void set_MessageSourceType (SendMailMessageSourceType value)
public final function get MessageSourceType () : SendMailMessageSourceType

public final function set MessageSourceType (value : SendMailMessageSourceType)

Property Value

One of the SendMailMessageSourceType values.

Example

The following code sample creates, configures, and executes a new SendMailTask that uses the MessageSourceType property.

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

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

SendMailTask Class
SendMailTask Members
Microsoft.SqlServer.Dts.Tasks.SendMailTask Namespace