cancel
Showing results for 
Search instead for 
Did you mean: 

Undefined variables, no error

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Undefined variables, no error

Hello there,

 

I had a Plugin with the following code:

 

$senderInfo = ['name' => 'The name', 'email' => 'ex@ample.com'];

$transport = $transportBuilder->setTemplateIdentifier('my_mail_template')
->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID])
->setTemplateVars(['data' => $postObject])
->setFrom($sender)
->addTo("ex@ample.com")
->setReplyTo("ex@ample.com")
->getTransport();
$transport->sendMessage();

As you can see, there is a mistake in ->setFrom($sender), it should be ->setFrom($senderInfo). So $sender wasn't defined. This leads to that, that the Plugin didn't work. I had absolutely no error message in output and not in the log files.

 

I'm in developer mode. I think Magento should give me these errors, because it takes a long time to find out why it isn't working.

 

Thank you very much.

 

Kind regards

 

Christoph