PHP ActiveX Requires Chilkat v11.0.0+
PHP ActiveX
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 PHP ActiveX Downloads
<?php
$success = 0;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
$email = new COM("Chilkat.Email");
$email->From = 'Workshop team <events@example.com>';
$success = $email->AddTo('Alex Rivera','alex@example.net');
if ($success != 1) {
print $email->LastErrorText . "\n";
exit;
}
$email->Subject = 'Workshop registration';
$email->Body = 'Your workshop confirmation.';
$success = $email->AddBcc('Archive','archive@example.com');
if ($success != 1) {
print $email->LastErrorText . "\n";
exit;
}
$i = 0;
while (($i < $email->NumBcc)) {
print 'Envelope blind copy: ' . $email->getBccAddr($i) . "\n";
$i = $i + 1;
}
// Keep the original delivery list intact. Remove blind copies from the export.
$rendered = new COM("Chilkat.BinData");
$success = $email->GetMimeBd($rendered);
if ($success != 1) {
print $email->LastErrorText . "\n";
exit;
}
$copy = new COM("Chilkat.Email");
$success = $copy->SetFromMimeBd($rendered);
if ($success != 1) {
print $copy->LastErrorText . "\n";
exit;
}
$copy->ClearBcc();
$success = $copy->SaveEml('shareable.eml');
if ($success != 1) {
print $copy->LastErrorText . "\n";
exit;
}
print 'Bcc entries in shareable copy: ' . $copy->NumBcc . "\n";
?>