Getting error when trying to send email via controller

 $email_Template = 'hello_template';  
    $email_Subject = 'Customer Registration Success';

    $transport = $this->transportBuilder
        ->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $this->storeManager->getStore()->getId()])
            'name'  => 'aaaa',
            'email'  => $data['email'],
            'subject'  => $email_Subject
        ->setFrom(['name' => 'test','email' => '[email protected]'])

How to debug the error.

I have already tried by removing generated folder & re run all magento2 compilation commands

I am using Magento2.3.3

1 Answer 1


Change the following code:



->addTo($data['email'], 'Name')
  • I did this above change in my code, but still getting the same error. Can you please help here? Jan 4, 2022 at 6:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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