SQL Server
SQL Server
Clear the Bcc Recipients of an Email
See more Email Object Examples
Demonstrates the Chilkat Email.ClearBcc method, which clears the list of blind carbon-copy (Bcc) recipients. It changes only the current in-memory email object and does not affect messages already sent. This example adds two Bcc recipients, clears them, and prints the count before and after.
Background: Reusing one
Email object as a template for several messages is common — you set the subject and body once and vary the recipients. Clearing methods like ClearBcc, ClearCC, and ClearTo let you reset one recipient list between sends without rebuilding the whole message, so a stray Bcc from a previous send does not leak into the next.Chilkat SQL Server Downloads
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Demonstrates the ClearBcc method, which clears the list of blind carbon-copy (Bcc)
-- recipients. This changes only the current email object.
DECLARE @email int
EXEC @hr = sp_OACreate 'Chilkat.Email', @email OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
EXEC sp_OAMethod @email, 'AddBcc', @success OUT, 'Joe', 'joe@example.com'
EXEC sp_OAMethod @email, 'AddBcc', @success OUT, 'Jane', 'jane@example.com'
EXEC sp_OAGetProperty @email, 'NumBcc', @iTmp0 OUT
PRINT 'NumBcc before clear = ' + @iTmp0
-- Remove all Bcc recipients.
EXEC sp_OAMethod @email, 'ClearBcc', NULL
EXEC sp_OAGetProperty @email, 'NumBcc', @iTmp0 OUT
PRINT 'NumBcc after clear = ' + @iTmp0
EXEC @hr = sp_OADestroy @email
END
GO