I have Sql Server Agent Jobs which send emails once a day, each of them containing one excel file. They are similar to each other in many ways; they complete the steps successfully, and have no problem with sp_send_dbmail procedure.
USE msdb
GO
DECLARE @tablename varchar(200)
set @tablename = 'MyTable' + '.xls'
EXEC sp_send_dbmail
@profile_name = 'x',
@recipients = 'example@abc.com',
@copy_recipients = ' example2@abc.com',
@subject = 'Excel Report',
@body = 'File attached.',
@file_attachments = @tablename
However; some of these jobs send the email twice. I have checked that the jobs run once a day and sp_send_dbmail procedures are called once. I disabled&enabled the job, still getting double mails. I deleted and re-created the job, it made no difference. It is really interesting how other similar jobs just work very fine, while another one just sends the mail two times.
Any ideas about what the reason can be for the Job to send duplicate emails?