0

I have a job set up on SQL Server 2012 to send weekly emails to specific recipients, and I am diagnosing an issue where users have been receiving duplicate emails.

I have traced the issue back to a BCC recipient that is no longer with the company and thus the email was failing to send to their account (but the e-mail still sends to the TO and CC recipients, even though the log shows that the email failed).

The Database Mail is configured to retry once on a failure after 60 seconds, which causes the email to be sent twice to the recipients with valid email addresses.

I have corrected the issue with the invalid recipient, but I want to eliminate this issue for similar issues in the future.

Is there a way to have the server attempt to retry on failure, but only to recipients who did not receive the email on the first attempt? I know that I can reduce the retry attempts to 0, but I fear that that the system will miss other failures where a retry would actually be appropriate.

Kevin
  • 172
  • 1
  • 12
  • 1
    I can't think of a simplistic way to do this that would actually be worth your time. I would, instead, log the failure and/or trigger a job to send YOU a notification of the failure so that you can address it without spamming everyone. Otherwise, if you could do what you wanted, you would only be ignoring the problem... it would always fail (and succeed) and you'd never know it thus never fix it. – S3S Jan 04 '17 at 21:04
  • That's a great suggestion! – Kevin Jan 04 '17 at 21:17
  • We do it a lot... some stuff similar to http://dba.stackexchange.com/a/88812/95107 though your job may actually return a success so you may have to wrap your code in a try/catch to return any errors on the db_mailer side. – S3S Jan 04 '17 at 21:20
  • The first thing to try is to increase your resend timeout from 60 seconds to something more like 180 or even 300. – Serg Jan 08 '18 at 07:03

0 Answers0