SendMailTask.Subject Propiedad

Definición

Obtiene o establece el asunto del mensaje de correo electrónico.

public:
 property System::String ^ Subject { System::String ^ get(); void set(System::String ^ value); };
public string Subject { get; set; }
member this.Subject : string with get, set
Public Property Subject As String

Valor de propiedad

Cadena que contiene el asunto del mensaje de correo electrónico.

Implementaciones

Ejemplos

El ejemplo de código siguiente crea, configura y ejecuta un nuevo SendMailTask objeto que usa la Subject propiedad .

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  

Se aplica a