Sample code for 30+ languages & platforms
Visual FoxPro 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 Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loEmail
LOCAL loMail

lnSuccess = 0

*  Assumes Chilkat is unlocked. See Global Unlock Sample.

loEmail = CreateObject('Chilkat.Email')
lnSuccess = loEmail.LoadEml("with-attachments.eml")
IF (lnSuccess <> 1) THEN
    ? loEmail.LastErrorText
    RELEASE loEmail
    CANCEL
ENDIF

*  Enable this option before adding a blind recipient to the message.
loEmail.UncommonOptions = "NoBccHeader"
lnSuccess = loEmail.AddBcc("Bcc recipient","bcc@example.net")
IF (lnSuccess <> 1) THEN
    ? loEmail.LastErrorText
    RELEASE loEmail
    CANCEL
ENDIF

loMail = CreateObject('Chilkat.MailMan')
loMail.SmtpHost = "smtp.example.com"
loMail.SmtpPort = 465
loMail.SmtpSsl = 1
loMail.RequireSslCertVerify = 1
loMail.SmtpUsername = "MAIL_USER"
loMail.SmtpPassword = "MAIL_PASSWORD"
lnSuccess = loMail.SendEmail(loEmail)
IF (lnSuccess <> 1) THEN
    ? loMail.LastErrorText
    RELEASE loEmail
    RELEASE loMail
    CANCEL
ENDIF

? "The SMTP relay accepted the message."
lnSuccess = loMail.CloseSmtpConnection()
IF (lnSuccess <> 1) THEN
    ? loMail.LastErrorText
    RELEASE loEmail
    RELEASE loMail
    CANCEL
ENDIF

RELEASE loEmail
RELEASE loMail