Sample code for 30+ languages & platforms
Tcl Requires Chilkat v11.0.0+

Send an email with a Bcc recipient using SMTP (live send)

See more Email Object Examples

Live send. Load the previously prepared with-attachments.eml, add a Bcc recipient, and pass the Email to MailMan.SendEmail. For a real test, use a relay you control, replace the sample sender and recipients (including the Bcc address) with test mailboxes, and obtain credentials from your application’s secret store.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

#  Assumes Chilkat is unlocked. See Global Unlock Sample.

set email [new_CkEmail]

set success [CkEmail_LoadEml $email "with-attachments.eml"]
if {$success != 1} then {
    puts [CkEmail_lastErrorText $email]
    delete_CkEmail $email
    exit
}

#  Enable this option before adding a blind recipient to the message.
CkEmail_put_UncommonOptions $email "NoBccHeader"
set success [CkEmail_AddBcc $email "Bcc recipient" "bcc@example.net"]
if {$success != 1} then {
    puts [CkEmail_lastErrorText $email]
    delete_CkEmail $email
    exit
}

set mail [new_CkMailMan]

CkMailMan_put_SmtpHost $mail "smtp.example.com"
CkMailMan_put_SmtpPort $mail 465
CkMailMan_put_SmtpSsl $mail 1
CkMailMan_put_RequireSslCertVerify $mail 1
CkMailMan_put_SmtpUsername $mail "MAIL_USER"
CkMailMan_put_SmtpPassword $mail "MAIL_PASSWORD"
set success [CkMailMan_SendEmail $mail $email]
if {$success != 1} then {
    puts [CkMailMan_lastErrorText $mail]
    delete_CkEmail $email
    delete_CkMailMan $mail
    exit
}

puts "The SMTP relay accepted the message."
set success [CkMailMan_CloseSmtpConnection $mail]
if {$success != 1} then {
    puts [CkMailMan_lastErrorText $mail]
    delete_CkEmail $email
    delete_CkMailMan $mail
    exit
}


delete_CkEmail $email
delete_CkMailMan $mail