Delphi DLL Requires Chilkat v11.0.0+
Delphi DLL
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 Delphi DLL Downloads
var
success: Boolean;
email: HCkEmail;
mail: HCkMailMan;
begin
success := False;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
email := CkEmail_Create();
success := CkEmail_LoadEml(email,'with-attachments.eml');
if (success <> True) then
begin
Memo1.Lines.Add(CkEmail__lastErrorText(email));
Exit;
end;
// Enable this option before adding a blind recipient to the message.
CkEmail_putUncommonOptions(email,'NoBccHeader');
success := CkEmail_AddBcc(email,'Bcc recipient','bcc@example.net');
if (success <> True) then
begin
Memo1.Lines.Add(CkEmail__lastErrorText(email));
Exit;
end;
mail := CkMailMan_Create();
CkMailMan_putSmtpHost(mail,'smtp.example.com');
CkMailMan_putSmtpPort(mail,465);
CkMailMan_putSmtpSsl(mail,True);
CkMailMan_putRequireSslCertVerify(mail,True);
CkMailMan_putSmtpUsername(mail,'MAIL_USER');
CkMailMan_putSmtpPassword(mail,'MAIL_PASSWORD');
success := CkMailMan_SendEmail(mail,email);
if (success <> True) then
begin
Memo1.Lines.Add(CkMailMan__lastErrorText(mail));
Exit;
end;
Memo1.Lines.Add('The SMTP relay accepted the message.');
success := CkMailMan_CloseSmtpConnection(mail);
if (success <> True) then
begin
Memo1.Lines.Add(CkMailMan__lastErrorText(mail));
Exit;
end;
CkEmail_Dispose(email);
CkMailMan_Dispose(mail);