Command SMTP_Bcc

4D Internet Commands

SMTP_Bcc

version 6.5


SMTP_Bcc (smtp_ID; blindCarbon{; deleteOption}) Integer

ParameterTypeDescription
smtp_IDLongintMessage reference
blindCarbonTextAddressList
deleteOptionInteger0 = Add, 1 = Replace, 2 = Delete

Function result Integer Error Code

Description

The SMTP_Bcc command adds blind carbon copy recipients to the message specified by smtp_ID. It is not mandatory to have any addresses in the Bcc: field.

The only way to keep AddressList information confidential when sending mail to groups of people is to list the addresses within the "Bcc" header. The addresses listing in a "Bcc" header are not sent as part of the message header or body. The addresses will not be viewable by any recipient specified in the "To", "Cc" or "Bcc" headers.

The "Bcc" recipients will be able to see all "To" and "Cc" recipients, but they will not be able to see other "Bcc" recipients. Often group mailings to a large number of recipients will be addressed with all recipients placed in the "Bcc" header. This prevents the users from having large address lists cluttering the message and keeps them from accessing the addresses of others.

Another reason for the use of "Bcc" is that many mail applications have a "Reply All" feature which will add all recipients in the "To" and "Cc" sections to the replying message. Placing all recipient addresses within the "Bcc" header will prevent users from replying to every person who received the original message.

smtp_ID is the long integer reference to a message created with the SMTP_New command.

blindCarbon is a text value containing an AddressList of one or more mail addresses.

deleteOption is an integer value which specifies whether to add or delete the "Bcc" header:

• A value of zero will add the new value to the "Bcc" field.

• A value of 1 will set the "Bcc" field to the new value, overriding any prior settings (if you pass an empty string in blindCarbon, the header will be removed from the mail envelope).

• A value of 2 will delete any address previously defined for the "Bcc" field and remove the header from the mail envelope.

deleteOption is an optional parameter which will default to zero if not otherwise specified.

Example

In this example a message is created and the static elements are defined outside the scope of the 'for' loop. Then, for each record in the [People] table, an address is added to the blind carbon copy list.

   $error:=SMTP_From ($smtp_id;"[email protected]")
   $error:=SMTP_Subject ($smtp_id;"Terrific Sale! This week only!")
   $error:=SMTP_Body ($smtp_id;$GenericBody)
   For($i;1;Records in Selection([People]))
      $error:=SMTP_Bcc ($smtp_id;[People]Email;0)   `Add this email address to the BCC list
      NEXT RECORD([People])
   End for
   $error:=SMTP_Send ($smtp_id)   `Send the message to everyone
   $error:=SMTP_Clear ($smtp_id)

See Also

SMTP_Cc, SMTP_New.