SQL Server
SQL Server
Add Multiple Bcc Recipients at Once
See more Email Object Examples
Demonstrates the Chilkat Email.AddMultipleBcc method, which parses a comma-separated list of mailbox addresses and appends them all to the blind carbon-copy (Bcc) recipient list. Each entry may include a display name (e.g. Joe <joe@example.com>). This example adds three Bcc recipients in one call.
Background: Address lists in email are comma-separated, and each entry can be either a bare address (
jane@example.com) or a named form (Jane Doe <jane@example.com>). AddMultipleBcc parses that syntax for you, which is convenient when recipients come from a database column or a config file as a single string — rather than calling AddBcc once per person, you hand over the whole list at once.Chilkat SQL Server Downloads
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Demonstrates the AddMultipleBcc method, which parses a comma-separated list of
-- addresses and appends them all to the blind carbon-copy (Bcc) recipient list.
DECLARE @email int
EXEC @hr = sp_OACreate 'Chilkat.Email', @email OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
EXEC sp_OASetProperty @email, 'Subject', 'Multiple Bcc example'
EXEC sp_OASetProperty @email, 'From', 'alice@example.com'
-- Add several Bcc recipients at once. Each entry may include a display name.
DECLARE @success int
EXEC sp_OAMethod @email, 'AddMultipleBcc', @success OUT, 'Joe <joe@example.com>, jane@example.com, Bob <bob@example.com>'
EXEC sp_OAGetProperty @email, 'NumBcc', @iTmp0 OUT
PRINT 'NumBcc = ' + @iTmp0
EXEC @hr = sp_OADestroy @email
END
GO