We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    • While auditing the code we found the below error code was generated in the system log :
    PHP Fatal error: Uncaught TypeError: Argument 1 passed to MagentoEmailModelTemplate::setVars() must be of the type array, null given

    Above Error throwing due to adding comma separated email in Sales Emails > Order > order copy

    check the below screenshot for reference:

    • Please follow the below steps to get resolved error:   

      It has the issue with the file which has below path

    vendor/magento/module-sales/Model/Order/Email/SenderBuilder.php

    Please override the above file by

    Replacing this Function :

    public function sendCopyTo()
        {
            $copyTo = $this->identityContainer->getEmailCopyTo();
    
            if (!empty($copyTo) && $this->identityContainer->getCopyMethod() == 'copy') {
                $this->configureEmailTemplate();
                foreach ($copyTo as $email) {
                    $this->transportBuilder->addTo($email);
                    $transport = $this->transportBuilder->getTransport();
                    $transport->sendMessage();
                }
            }
        }

    With :

    public function sendCopyTo()
        {
            $copyTo = $this->identityContainer->getEmailCopyTo();
    
            if (!empty($copyTo) && $this->identityContainer->getCopyMethod() == 'copy') {
                
                foreach ($copyTo as $email) {
                    $this->configureEmailTemplate();
                    $this->transportBuilder->addTo($email);
                    $transport = $this->transportBuilder->getTransport();
                    $transport->sendMessage();
                }
            }
        }

    That’s It! Now you can add multiple emails with comma-separated.

    Please let me know your thought if this blog is helpful to You.

     

    field_5bfb909c5ccae

      Get a Free Quote