June 9, 2013 at 3:20 am
All,
My problem scenarion is:
"I have a SQL agent job setup that calls a SP which collects all data and sends a report to some email ids via msdb.dbo.sp_send_dbmail.
The job is scheduled to run daily once around 8:30 PM. Below T-SQL is part of the SP to send the email
exec msdb.dbo.sp_send_dbmail @recipients=@EMAILID,@blind_copy_recipients=@BCC,
@subject = @Subject1 ,
@body = @body1,
@body_format = 'HTML' ;
END"
Users say that they do receive email on the report but they receive 2 similar emails at the same time.
But the job is scheduled to run only once a day and there is no duplicate job to send email for the same report and to same users.
How do I trouble shoot from where the second email is going?
Is @recipients=@EMAILID,@blind_copy_recipients=@BCC the issue?
June 10, 2013 at 12:48 pm
t2sqldba (6/9/2013)
All,My problem scenarion is:
"I have a SQL agent job setup that calls a SP which collects all data and sends a report to some email ids via msdb.dbo.sp_send_dbmail.
The job is scheduled to run daily once around 8:30 PM. Below T-SQL is part of the SP to send the email
exec msdb.dbo.sp_send_dbmail @recipients=@EMAILID,@blind_copy_recipients=@BCC,
@subject = @Subject1 ,
@body = @body1,
@body_format = 'HTML' ;
END"
Users say that they do receive email on the report but they receive 2 similar emails at the same time.
But the job is scheduled to run only once a day and there is no duplicate job to send email for the same report and to same users.
How do I trouble shoot from where the second email is going?
Is @recipients=@EMAILID,@blind_copy_recipients=@BCC the issue?
This may be a silly question, but are you sure you didn't leave the same job running in a testing or development environment that could be generating the second e-mail?
I would start by checking the values in your @EMAILID and @BCC variables at run time. I would consider adding a line of code that writes those values to a log table so I could view their values later.
Jason Wolfkill
June 10, 2013 at 10:52 pm
Is it possible the stored procedure is sending more than one report? Could you send us a code snippet?
--------
For SQL Tips, check out my blog: http://lantztechknowledge.blogspot.com/[/url]
You can also follow my twitter account to get daily updates: @BLantz2455
June 11, 2013 at 1:53 am
wolfkillj (6/10/2013)
I would start by checking the values in your @EMAILID and @BCC variables at run time. I would consider adding a line of code that writes those values to a log table so I could view their values later.
Including checking if any of the names are included in any email groups on the lists.
If you are generating the email could also be that it hasn't completed sending and hence hasn't been flagged as sent before the next poll.
June 11, 2013 at 7:29 am
wolfkillj (6/10/2013)
I would consider adding a line of code that writes those values to a log table so I could view their values later.
SELECT
recipients,
copy_recipients,
blind_copy_recipients,
send_request_date,
sent_date,
sent_status
FROM
msdb..sysmail_allitems
June 11, 2013 at 9:16 am
found this in one of the post . see below.
1. Open database mail configuration wizard.
2. Select view or change system parameters option
3. set the "Account retry attempts" to 0
June 13, 2013 at 4:15 am
Hi All,
Thanks for your replies.
I have used below script
SELECT *
FROM msdb.[dbo].[sysmail_allitems]
And also asked user to share with me the email notification they received.
I could solve the problem.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply