I need Simple mailing using Script task in SSIS 2008 R2

  • Hi Friends,

    I am working in a package where i need to send a mail to users. I am getting the mailing success using Send Mail Task. But, using Script task, i don't know how to send a mail. can some one help me sending a simple mail script used in script task (VB.Net code).

    Here is the code which i tried.

    Imports System.Net

    Imports System.Net.Mail

    Dim myHtmlMessage As MailMessage

    Dim mySmtpClient As SmtpClient

    myHtmlMessage = New MailMessage(Dts.Variables("Str_HtmlEmailFrom").Value.ToString, Dts.Variables("Str_HtmlEmailTo").Value.ToString, Dts.Variables("Str_HtmlEmailSubject").Value.ToString, Dts.Variables("Str_HtmlEmailBody").Value.ToString)

    mySmtpClient = New SmtpClient(Dts.Variables("Str_HtmlEmailServer").Value.ToString)

    mySmtpClient.Send(myHtmlMessage)

    mySmtpClient.Credentials = CredentialCache.DefaultCredentials

    Thanks in advance.

    Regards,

    Karthik.

    Regards,
    Karthik.
    SQL Developer.

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply