a rough example of multiple recipients from a query, unique emails, same attachment:
declare
@isql varchar(2000),
@email varchar(64)
declare c1 cursor for select distinct email FROM DatabaseName.dbo.SomeTable WHERE CampaignID = 42 and dbo.IsValidEmail(email) = 1
open c1
fetch next from c1 into @email
While @@fetch_status <> -1
begin
declare @body1 varchar(4000)
set @body1 = 'Latest documentation For You. ' + CONVERT( VARCHAR( 20 ), GETDATE(), 113 ) +
' '
EXEC msdb.dbo.sp_send_dbmail @recipients=@email,
@subject = 'Latest documentation ',
@body = @body1,
@body_format = 'HTML',
@file_attachments = 'c:\ServerAttachments\ERP.pdf'
fetch next from c1 into @email
end
close c1
deallocate c1
Lowell