Sample code for 30+ languages & platforms
SQL Server

Count the Bcc Recipients of an Email

See more Email Object Examples

Demonstrates the read-only Chilkat Email.NumBcc property, which is the number of blind carbon-copy (Bcc) recipients. Bcc recipient indexes are zero-based and can be inspected with GetBcc, GetBccAddr, and GetBccName. This example adds two Bcc recipients and prints the count.

Background: Email has three recipient lists: To (primary), Cc (carbon copy), and Bcc (blind carbon copy). The key difference is visibility: To and Cc addresses appear in the delivered message's headers for everyone to see, but Bcc recipients are hidden — the Bcc header is stripped before delivery so no recipient can tell who else was blind-copied.

Chilkat SQL Server Downloads

SQL Server
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    --  Demonstrates the read-only Email.NumBcc property, which is the number of
    --  blind carbon-copy (Bcc) recipients.  Bcc indexes are zero-based.

    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 = ' + @iTmp0

    EXEC @hr = sp_OADestroy @email


END
GO