开发者

Handling failure of the Send Mail Task in SSIS

开发者 https://www.devze.com 2023-02-20 06:59 出处:网络
I have an SSIS package that sends mails for each record within a Foreach Loop Container.After the e-mail is sent, I add some text to a variable (within a Script Task) saying \"Mail sent to customer1@d

I have an SSIS package that sends mails for each record within a Foreach Loop Container. After the e-mail is sent, I add some text to a variable (within a Script Task) saying "Mail sent to customer1@domain.com".

However, I would also like to log when the e-mail fails. I added another script task after the Send Mail Task and changed the constraint to "Failure". I then changed one of the e-mail addresses to an invalid format (like "abc"). Whe开发者_如何学编程n I run it, it fails on the Send Mail Task, but does not go through my Script Task that has the Failure constraint. In other words, the whole package stops because of this failure. I have tried messing around with the FailPackageOnFailure and FailParentOnFailure properties, but I still can't get this to work.

Is there a better way to handle this? I thought my method was pretty simple, but this is not the expected behaviour (for me, anyway).

I would greatly appreciate any suggestions or comments. Thank you!


Can you trap the error in the OnError Event Handler for the Send Mail Task?


I have done the same a while ago, i had a problem with variable lock : i was retrieving the SMTP Credential in some variables (login, password, SSL enabled ...) when the package fail i was trying to send another email using the same variables, but they still locked by the first script task (so it fail). I hade to get the variables and release them programmatically (try-catch-finally) in the first email script task so i'm sure that ther will be no variable lock in the second.

Hope this help

0

精彩评论

暂无评论...
验证码 换一张
取 消