{"id":19010913,"date":"2026-09-03T16:43:15","date_gmt":"2026-09-03T16:43:15","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/microsoft-graph-bcc-not-working\/"},"modified":"2026-09-03T16:43:15","modified_gmt":"2026-09-03T16:43:15","slug":"microsoft-graph-bcc-not-working","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/microsoft-graph-bcc-not-working\/","title":{"rendered":"Microsoft Graph Bcc not working"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>FluentSMTP resets PHPMailer to &#8220;mail&#8221; mode<\/strong>, not SMTP mode, before every send \u2014 see <a href=\"\/\/1l5ls4fv4o9gj7e94oaeq7ha2r5otheketjstu2d16e6525iidre\/fluent-smtp\/app\/Functions\/helpers.php#L639\" target=\"_blank\" rel=\"noreferrer noopener\">helpers.php:639<\/a> (<code>$phpmailer-&gt;isMail()<\/code>), and no code path in the Outlook provider ever calls <code>isSMTP()<\/code> (only <code>Providers\\Smtp\\Handler.php:45<\/code> does that, for the plain-SMTP connection type).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>That mode matters a lot for Bcc.<\/strong> PHPMailer only <em>omits<\/em> the <code>Bcc:<\/code> header from the generated MIME when <code>Mailer === 'smtp'<\/code> (because in real SMTP mode it delivers Bcc via an extra invisible <code>RCPT TO<\/code> command instead). Since Outlook&#8217;s mode is <code>'mail'<\/code>, PHPMailer <strong>does<\/strong> write a <code>Bcc:<\/code> header into the raw MIME \u2014 so at the PHP level, Bcc is present, right alongside Cc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>But the Outlook handler throws that context away.<\/strong> <a href=\"\/\/1l5ls4fv4o9gj7e94oaeq7ha2r5otheketjstu2d16e6525iidre\/fluent-smtp\/app\/Services\/Mailer\/Providers\/Outlook\/Handler.php#L77-L102\" target=\"_blank\" rel=\"noreferrer noopener\">Outlook\/Handler.php:77-102<\/a> (<code>sendViaApi()<\/code>) just grabs <code>$this-&gt;phpMailer-&gt;getSentMIMEMessage()<\/code>, base64-encodes it, and POSTs the raw MIME blob to <code>https:\/\/graph.microsoft.com\/v1.0\/me\/sendMail<\/code> (<a href=\"\/\/1l5ls4fv4o9gj7e94oaeq7ha2r5otheketjstu2d16e6525iidre\/fluent-smtp\/app\/Services\/Mailer\/Providers\/Outlook\/API.php#L133-L142\" target=\"_blank\" rel=\"noreferrer noopener\">Outlook\/API.php:133-142<\/a>) with <code>Content-Type: text\/plain<\/code>. That&#8217;s it \u2014 no structured JSON recipients are sent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Microsoft Graph&#8217;s raw-MIME ingestion at <code>\/me\/sendMail<\/code> parses <code>To:<\/code> and <code>Cc:<\/code> out of the header block fine, but doesn&#8217;t route delivery off a <code>Bcc:<\/code> header found in raw MIME content.<\/strong> It only honors Bcc when it&#8217;s supplied as a structured <code>bccRecipients<\/code> field. This is a known Graph API quirk with the &#8220;upload raw MIME&#8221; send path \u2014 not something this plugin&#8217;s header-building is getting wrong.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Proof it&#8217;s architectural, not accidental:<\/strong> other providers in this same FluentSMTP install handle Bcc correctly <em>because<\/em> they don&#8217;t use the raw-MIME path. <code>BaseHandler::setAttributes()<\/code> (around <a href=\"\/\/1l5ls4fv4o9gj7e94oaeq7ha2r5otheketjstu2d16e6525iidre\/fluent-smtp\/app\/Services\/Mailer\/BaseHandler.php#L186-L206\" target=\"_blank\" rel=\"noreferrer noopener\">BaseHandler.php:186-206<\/a>) already extracts <code>getBccAddresses()<\/code> into <code>$attributes['headers']['bcc']<\/code> for every provider \u2014 and Mailgun&#8217;s handler actually uses it (<a href=\"\/\/1l5ls4fv4o9gj7e94oaeq7ha2r5otheketjstu2d16e6525iidre\/fluent-smtp\/app\/Services\/Mailer\/Providers\/Mailgun\/Handler.php#L65\" target=\"_blank\" rel=\"noreferrer noopener\">Mailgun\/Handler.php:65,152<\/a>), building its own <code>bcc<\/code> field in its API call. The Outlook handler is the one provider that ignores this pre-computed data entirely.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ways to actually fix it (not applying any of these yet):<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best fix<\/strong>\u00a0\u2014 change\u00a0<code>Outlook\\Handler::sendViaApi()<\/code>\u00a0to stop using the raw-MIME\u00a0<code>\/sendMail<\/code>\u00a0endpoint, and instead build the structured Graph JSON payload (<code>message.toRecipients<\/code>\u00a0\/\u00a0<code>ccRecipients<\/code>\u00a0\/\u00a0<code>bccRecipients<\/code>), pulling bcc from the\u00a0<code>headers.bcc<\/code>\u00a0array\u00a0<code>BaseHandler<\/code>\u00a0already computes \u2014 mirroring what Mailgun&#8217;s handler does today.<\/p>\n\n\n\n<ol><\/ol>\n","protected":false},"template":"","class_list":["post-19010913","topic","type-topic","status-publish","hentry","topic-tag-bcc","topic-tag-outlook"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19010913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19010913\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19010913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}