Delphi ActiveX Requires Chilkat v11.0.0+
Delphi ActiveX
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 ActiveX Downloads
var
success: Integer;
email: TChilkatEmail;
mail: TChilkatMailMan;
begin
success := 0;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
email := TChilkatEmail.Create(Self);
success := email.LoadEml('with-attachments.eml');
if (success <> 1) then
begin
Memo1.Lines.Add(email.LastErrorText);
Exit;
end;
// Enable this option before adding a blind recipient to the message.
email.UncommonOptions := 'NoBccHeader';
success := email.AddBcc('Bcc recipient','bcc@example.net');
if (success <> 1) then
begin
Memo1.Lines.Add(email.LastErrorText);
Exit;
end;
mail := TChilkatMailMan.Create(Self);
mail.SmtpHost := 'smtp.example.com';
mail.SmtpPort := 465;
mail.SmtpSsl := 1;
mail.RequireSslCertVerify := 1;
mail.SmtpUsername := 'MAIL_USER';
mail.SmtpPassword := 'MAIL_PASSWORD';
success := mail.SendEmail(email.ControlInterface);
if (success <> 1) then
begin
Memo1.Lines.Add(mail.LastErrorText);
Exit;
end;
Memo1.Lines.Add('The SMTP relay accepted the message.');
success := mail.CloseSmtpConnection();
if (success <> 1) then
begin
Memo1.Lines.Add(mail.LastErrorText);
Exit;
end;