Bob Goblin
Bob Goblin

Reputation: 1269

SendMail to multiple contacts

I know how to use this SQL Server 2008 feature to send to 1 contant and bcc one contact, but how do I send to 3 contacts?

Would the syntax be like such? This only sends the message to the 1st email address listed:

exec msdb.dbo.sp_send_dbmail 
  @profile_name = 'DatabaseMail', 
  @recipients = '[email protected]';'[email protected]'
  @blind_copy_recipients = '[email protected]',
  @body_format = 'HTML',
  @from_address = 'Auto-Generated <[email protected]>',
  @body = @tableHTML,
  @subject = @subject;

Upvotes: 0

Views: 237

Answers (1)

LDMJoe
LDMJoe

Reputation: 1589

Per MSDN

[ @recipients= ] 'recipients'

Is a semicolon-delimited list of e-mail addresses to send the message to. The recipients list is of type varchar(max). Although this parameter is optional, at least one of @recipients, @copy_recipients, or @blind_copy_recipients must be specified, or sp_send_dbmail returns an error.

exec msdb.dbo.sp_send_dbmail 
  @profile_name = 'DatabaseMail', 
  @recipients = '[email protected];[email protected]'
  @blind_copy_recipients = '[email protected]',
  @body_format = 'HTML',
  @from_address = 'Auto-Generated <[email protected]>',
  @body = @tableHTML,
  @subject = @subject;

Upvotes: 2

Related Questions