I am trying to create an email project that Outlook will open (so that the user can make changes before actually sending). I use PHPMailer and everything works: coding, attachments, everything except the BCC field .
<?php
$mail = new PhpMailer();
$mail->CharSet = 'UTF-8';
$body = '<html><body><p>does not matter</p></body></html>';
foreach ($contacts as $address) {
if ($this->looksLikeEmail($address)) {
$mail->addAddress($address);
}
}
$businessContacts = $this->loadCcEmails();
foreach ($businessmenContacts as $address) {
if ($this->looksLikeEmail($address)) {
$mail->addCC($address);
}
}
$mail->addBCC($this->bccAddress);
$mail->Body = $body;
$mail->preSend();
$emailFull = $mail->MIMEHeader . $mail->LE . $mail->MIMEBody;
header('Content-Description: File Transfer');
header('Content-Type: message/rfc822');
header('Content-Disposition: inline; filename="template.eml"');
header('Cache-Control: private');
header('Content-Length: ' . strlen($emailFull));
echo $emailFull;
exit;
I add the BCC field, as usual, and is present in the file template.emlgenerated by PHP:
Date: Thu, 2 Jun 2016 10:53:35 +0200
To: foo@example.com
Cc: bar@example.com
Bcc: baz@example.com
Subject: =?UTF-8?Q?TESTOVAC=C3=8D?=
Message-ID: <f2693cd5b0b081a75408beef87bfc651@localizer>
X-Unsent: 1
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_f2693cd5b0b081a75408979287bfc651"
Content-Transfer-Encoding: 8bit
etc..
However, when opened in Outlook 2010, the BCC field is not populated at all; when the same file opens in Thunderbird, BCC fills up. Is there a way to get Outlook to pre-populate BCC in a draft without directly automating Outlook (I do not control users' computers, only on the server)?