Xbase++ Requires Chilkat v11.0.0+
Xbase++
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 Xbase++ Downloads
LOCAL nSuccess
LOCAL oEmail
LOCAL oMail
nSuccess := 0
// Assumes Chilkat is unlocked. See Global Unlock Sample.
oEmail := CreateObject("Chilkat.Email")
nSuccess := oEmail:LoadEml("with-attachments.eml")
IF (nSuccess != 1)
? oEmail:LastErrorText
oEmail:destroy()
RETURN
ENDIF
// Enable this option before adding a blind recipient to the message.
oEmail:UncommonOptions := "NoBccHeader"
nSuccess := oEmail:AddBcc("Bcc recipient", "bcc@example.net")
IF (nSuccess != 1)
? oEmail:LastErrorText
oEmail:destroy()
RETURN
ENDIF
oMail := CreateObject("Chilkat.MailMan")
oMail:SmtpHost := "smtp.example.com"
oMail:SmtpPort := 465
oMail:SmtpSsl := 1
oMail:RequireSslCertVerify := 1
oMail:SmtpUsername := "MAIL_USER"
oMail:SmtpPassword := "MAIL_PASSWORD"
nSuccess := oMail:SendEmail(oEmail)
IF (nSuccess != 1)
? oMail:LastErrorText
oEmail:destroy()
oMail:destroy()
RETURN
ENDIF
? "The SMTP relay accepted the message."
nSuccess := oMail:CloseSmtpConnection()
IF (nSuccess != 1)
? oMail:LastErrorText
oEmail:destroy()
oMail:destroy()
RETURN
ENDIF
oEmail:destroy()
oMail:destroy()