Exception #0 (Magento\Framework\Exception\RuntimeException): Type Error occurred when creating object: Magento\Framework\Mail\EmailMessage

$store = $this->_storeManager->getStore()->getId();
$transport = $this->_transportBuilder->setTemplateIdentifier('send_email_email_template')
    ->setTemplateOptions(['area' => 'frontend', 'store' => $store])
            'store' => $this->_storeManager->getStore(),

but on sending email to a single recipient


it sends without any load.

Magento Bug:



I am using Magento ver. 2.3.3 and I found in https://github.com/magento/magento2/issues/24984 that it was bug, I tried to resolve it by my own.

private function addAddressByType(string $addressType, $email, ?string $name = null): void
    if (is_string($email)) {
        $this->messageData[$addressType][] = $this->addressConverter->convert($email, $name);
    $convertedAddressArray = $this->addressConverter->convertMany($email);
    **$this->messageData[$addressType] = [];**
    if (isset($this->messageData[$addressType])) {
        $this->messageData[$addressType] = array_merge(

I added $this->messageData[$addressType] = []; in my function as it was not compiling code in if condition, not sure if it is right approach to do but I can send email to multiple recipients now.

| improve this answer | |

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.