Mail Succeeded- But No Attachment seen

sql server Philippines
  • 13 years ago
    Hi,
    In SSIS Scipt task, with all variables assigned.

    With the below code i was able to send mails, But after receiving it, there is no Attachment.

    Public Sub Main()

    Dim smtpServer As String = Dts.Variables("MailSMTPServer").Value.ToString
    Dim htmlMessageTo As String = Dts.Variables("ToLine").Value.ToString
    Dim htmlMessageFrom As String = Dts.Variables("FromLine").Value.ToString
    Dim htmlMessageSubject As String = Dts.Variables("MailSubj").Value.ToString
    Dim htmlMessageBody As String = Dts.Variables("MailBody").Value.ToString
    Dim htmlMessageLog As String = Dts.Variables("ErrorLog2").Value.ToString
    Dim htmlMessage As MailMessage
    Dim mySmtpClient As SmtpClient
    Dim m As New System.Net.Mail.MailMessage
    Dim AttachLog As Attachment = New Attachment(htmlMessageLog)

    htmlMessage = New MailMessage(htmlMessageFrom, htmlMessageTo, htmlMessageSubject, htmlMessageBody)

    mySmtpClient = New SmtpClient(" ")
    m.Attachments.Add(AttachLog)

    mySmtpClient.Credentials = New NetworkCredential(" ")

    mySmtpClient.Send(htmlMessage)

    Dts.TaskResult = Dts.Results.Success
    End Sub

    Please let me know, how can i see Attachment in my mail.

    Thanks.

     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Beware of bugs in the above code; I have only proved it correct, not tried it.” - Donald Knuth