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

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  // Assumes Chilkat is unlocked. See Global Unlock Sample.

  final email = CkEmail();
  try {
    email.loadEml('with-attachments.eml');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  // Enable this option before adding a blind recipient to the message.
  email.uncommonOptions = 'NoBccHeader';
  try {
    email.addBcc('Bcc recipient', 'bcc@example.net');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  final mail = CkMailMan();
  mail.smtpHost = 'smtp.example.com';
  mail.smtpPort = 465;
  mail.smtpSsl = true;
  mail.requireSslCertVerify = true;
  mail.smtpUsername = 'MAIL_USER';
  mail.smtpPassword = 'MAIL_PASSWORD';
  try {
    mail.sendEmail(email);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  print('The SMTP relay accepted the message.');
  try {
    mail.closeSmtpConnection();
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }
}