Duplicate Emails Being Sent using Send Mail Task

  • In SQL Server 2005 I'm using the Send Mail Task in the Event Handler to send me an email if any task within my package fails. I've set up the Send Mail Task to be at the "Executable" level and the Event Handler is set to "On Error". I'm testing only 1 task and have 1 Send Mail Task created.

    When my package fails it sends me 2 emails instead of 1 and I can't figure out why.

    The SMTP Connection has the SMTP server name filled in and the Use Windows authentication box checked.

    I believe my Event Handler is setup correctly and is shown below:

    smtpconnection: SMTP Connection Manager

    from: noreply@xxxxx.com

    to: me@xxxxx.com

    subject: SSIS xxx PACKAGE ERROR

    messagesourcetype: Direct Input

    messagesource: SSIS xxx PACKAGE ERROR

    priority: normal

    Any help would be appreciated.

  • I found an answer that works for my situation. Instead of using the Event Handler "OnError", I used "OnTaskFailed". Using this at the highest level of the package executable, I received only 1 email upon the package failure.

    I ran separate tests using 1 task and multiple tasks within a package and received only 1 email per test when setting the Event Handler to "OnTaskFailed".

  • This is just for the sake of understanding the issue

    You get multiple mails on 'OnError' because you are getting multiple errors in your package.

    On each error, an email is triggered by the error handler.

    You get 2 mails because there were 2 errors in the package. Please see the execution process for this.

    Thanks

    Pankaj

  • Let me clarify. I had only 1 error in the package. I tweaked the sql in one area to force the single error. There were 2 emails that resulted from the single error.

Viewing 4 posts - 1 through 3 (of 3 total)

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