Sample code for 30+ languages & platforms
SQL Server

Add a Bcc Recipient to an Email

See more Email Object Examples

Demonstrates the Chilkat Email.AddBcc method, which adds a single blind carbon-copy (Bcc) recipient. The first argument is the friendly display name and the second is the email address. This example adds one Bcc recipient and prints the resulting count.

Background: A Bcc ("blind carbon copy") recipient receives the message, but their address is hidden from everyone else — the mail server delivers the copy and then removes the Bcc header so no recipient can see who else was blind-copied. This makes Bcc the right choice for privacy (mailing a group without exposing addresses) and for silently keeping a copy in an archive or on a second address.

Chilkat SQL Server Downloads

SQL Server
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    --  Demonstrates the AddBcc method, which adds a single blind carbon-copy (Bcc) recipient.
    --  The 1st argument is the friendly (display) name, and the 2nd is the email address.

    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', 'Bcc example'
    EXEC sp_OASetProperty @email, 'From', 'alice@example.com'

    DECLARE @success int
    EXEC sp_OAMethod @email, 'AddBcc', @success OUT, 'Joe', 'joe@example.com'


    EXEC sp_OAGetProperty @email, 'NumBcc', @iTmp0 OUT
    PRINT 'NumBcc = ' + @iTmp0

    EXEC @hr = sp_OADestroy @email


END
GO