0

I am using below code to add BCC:

$transport = $this->_transportBuilder->setTemplateIdentifier($template)
                ->setTemplateOptions(['area' => 'frontend', 'store' => $store])
                ->setTemplateVars($templateVars)
                ->setFrom('sales')
                ->addTo($copy_to)
                ->addBcc('test@test.com')
                ->getTransport();
                $transport->sendMessage();

->addBcc('test@test.com') adds email ID to TO instead of adding it to BCC.

  • 1
    The code seems correct, can you try using core php code on root and send to bcc if that works, just for testing purpose? If it works, check how bcc is passed at vendor\magento\module-checkout\Helper\Data.php – Gagan Aug 9 '18 at 11:21
  • The code looks fine. – Sukumar Gorai Aug 9 '18 at 11:49
0

You can use arrays of emails like

$transport = $this->_transportBuilder->setTemplateIdentifier($template)
            ->setTemplateOptions(['area' => 'frontend', 'store' => $store])
            ->setTemplateVars($templateVars)
            ->setFrom('sales')
            ->addTo([$copy_to,'test@test.com'])
            ->getTransport();
            $transport->sendMessage();
0

I checked code is fine, issue was with my SMTP configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.