Failure of a package to send mail to SSIS
Is there a way to force a package to be compromised from the Send Mail task? We have a package, the final step of which is to send a bug report using the Send Mail command if certain criteria are met. We usually create another Script task directly after the Mail Task, which just fails in the batch using the code:
Dts.TaskResult = Dts.Results.Failure
Is there a way to eliminate the Script task and not execute the batch directly from the Send Mail task?
0
a source to share
2 answers
I had a similar scenario, instead of using a send mail task, I decided to send an email from a script task. The only way I have found is to combine sending email and failing a package in one step.
Dim Message As MailMessage
Dim Smtp As SmtpClient
Message = New MailMessage("email@domain.com", "email@domain.com", "Packaged Failed", "Package Failed because...")
Smtp = New SmtpClient(Dts.Variables("EmailServer").Value.ToString())
Smtp.Credentials = CredentialCache.DefaultNetworkCredentials
Smtp.Send(Message)
Dts.TaskResult = Dts.Results.Failure
+3
a source to share