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.
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).