PHP Requires Chilkat v11.0.0+
PHP
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 PHP Downloads
<?php
use Chilkat2\Email;
use Chilkat2\MailMan;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
$email = new Email();
try {
$email->LoadEml('with-attachments.eml');
// Enable this option before adding a blind recipient to the message.
$email->UncommonOptions = 'NoBccHeader';
$email->AddBcc('Bcc recipient', 'bcc@example.net');
$mail = new MailMan();
$mail->SmtpHost = 'smtp.example.com';
$mail->SmtpPort = 465;
$mail->SmtpSsl = true;
$mail->RequireSslCertVerify = true;
$mail->SmtpUsername = 'MAIL_USER';
$mail->SmtpPassword = 'MAIL_PASSWORD';
$mail->SendEmail($email);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
echo "The SMTP relay accepted the message.\n";
try {
$mail->CloseSmtpConnection();
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}