Sample code for 30+ languages & platforms
SQL Server

Add Multiple Cc Recipients at Once

See more Email Object Examples

Demonstrates the Chilkat Email.AddMultipleCC method, which parses a comma-separated list of mailbox addresses and appends them all to the carbon-copy (Cc) recipient list. Each entry may include a display name. This example adds two Cc recipients in a single call.

Background: Just like its Bcc counterpart, AddMultipleCC accepts the standard comma-separated address syntax and parses each mailbox for you. This is the natural choice when your recipients arrive as one string — for example a "cc these people" field — letting you populate the whole Cc list in a single step instead of splitting the string and calling AddCC repeatedly.

Chilkat SQL Server Downloads

SQL Server
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    --  Demonstrates the AddMultipleCC method, which parses a comma-separated list of
    --  addresses and appends them all to the carbon-copy (Cc) 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 Cc example'
    EXEC sp_OASetProperty @email, 'From', 'alice@example.com'

    --  Add several Cc recipients at once.
    DECLARE @success int
    EXEC sp_OAMethod @email, 'AddMultipleCC', @success OUT, 'joe@example.com, Jane <jane@example.com>'


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

    EXEC @hr = sp_OADestroy @email


END
GO