C++ Requires Chilkat v11.0.0+
C++
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 C++ Downloads
#include <CkEmail.h>
#include <CkBinData.h>
void ChilkatSample(void)
{
bool success = false;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
CkEmail email;
email.put_From("Workshop team <events@example.com>");
success = email.AddTo("Alex Rivera","alex@example.net");
if (success != true) {
std::cout << email.lastErrorText() << "\r\n";
return;
}
email.put_Subject("Workshop registration");
email.put_Body("Your workshop confirmation.");
success = email.AddBcc("Archive","archive@example.com");
if (success != true) {
std::cout << email.lastErrorText() << "\r\n";
return;
}
int i = 0;
while ((i < email.get_NumBcc())) {
std::cout << "Envelope blind copy: " << email.getBccAddr(i) << "\r\n";
i = i + 1;
}
// Keep the original delivery list intact. Remove blind copies from the export.
CkBinData rendered;
success = email.GetMimeBd(rendered);
if (success != true) {
std::cout << email.lastErrorText() << "\r\n";
return;
}
CkEmail copy;
success = copy.SetFromMimeBd(rendered);
if (success != true) {
std::cout << copy.lastErrorText() << "\r\n";
return;
}
copy.ClearBcc();
success = copy.SaveEml("shareable.eml");
if (success != true) {
std::cout << copy.lastErrorText() << "\r\n";
return;
}
std::cout << "Bcc entries in shareable copy: " << copy.get_NumBcc() << "\r\n";
}