Rust Requires Chilkat v11.0.0+
Rust
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 Rust Downloads
// Assumes Chilkat is unlocked. See Global Unlock Sample.
let email = chilkat::Email::new();
if email.load_eml("with-attachments.eml").is_err() {
println!("{}", email.last_error_text());
return;
}
// Enable this option before adding a blind recipient to the message.
email.set_uncommon_options("NoBccHeader");
if email.add_bcc("Bcc recipient", "bcc@example.net").is_err() {
println!("{}", email.last_error_text());
return;
}
let mail = chilkat::MailMan::new();
mail.set_smtp_host("smtp.example.com");
mail.set_smtp_port(465);
mail.set_smtp_ssl(true);
mail.set_require_ssl_cert_verify(true);
mail.set_smtp_username("MAIL_USER");
mail.set_smtp_password("MAIL_PASSWORD");
if mail.send_email(&email).is_err() {
println!("{}", mail.last_error_text());
return;
}
println!("The SMTP relay accepted the message.");
if mail.close_smtp_connection().is_err() {
println!("{}", mail.last_error_text());
return;
}