Node.js Requires Chilkat v11.0.0+
Node.js
Inspect blind-copy recipients and prepare a shareable copy
See more Email Object Examples
Keep the addressed Email object for SMTP submission. When exporting a copy to share, clear its Bcc collection before saving. Treat intermediate MIME buffers as private because a renderer can preserve blind-copy details.
Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
var email = new chilkat.Email();
email.From = "Workshop team <events@example.com>";
success = email.AddTo("Alex Rivera","alex@example.net");
if (success !== true) {
console.log(email.LastErrorText);
return;
}
email.Subject = "Workshop registration";
email.Body = "Your workshop confirmation.";
success = email.AddBcc("Archive","archive@example.com");
if (success !== true) {
console.log(email.LastErrorText);
return;
}
var i = 0;
while ((i < email.NumBcc)) {
console.log("Envelope blind copy: " + email.GetBccAddr(i));
i = i+1;
}
// Keep the original delivery list intact. Remove blind copies from the export.
var rendered = new chilkat.BinData();
success = email.GetMimeBd(rendered);
if (success !== true) {
console.log(email.LastErrorText);
return;
}
var copy = new chilkat.Email();
success = copy.SetFromMimeBd(rendered);
if (success !== true) {
console.log(copy.LastErrorText);
return;
}
copy.ClearBcc();
success = copy.SaveEml("shareable.eml");
if (success !== true) {
console.log(copy.LastErrorText);
return;
}
console.log("Bcc entries in shareable copy: " + copy.NumBcc);
}
chilkatExample();