I have a problem with my site processing email templates.

When I click preview on any email template it just produces a blank document. I have tried this with standard inbuilt templates and very simple templates with no variables, it always comes up blank.

When I make an order on the site, when it returns to the site from the payment provider, it tries to send the email, generates a 500 error and indicates that the order has failed.

In fact the payment has gone through, and the email has been sent multiple times, up to 9 times in one case.

> [16-Nov-2019 15:21:37 UTC] PHP Fatal error:  Uncaught TypeError:
> Argument 1 passed to Magento\Email\Model\Template::setVars() must be
> of the type array, null given, called in
> /vendor/magento/framework/Mail/Template/TransportBuilder.php on line
> 368 and defined in /vendor/magento/module-email/Model/Template.php:403
> Stack trace:
> #0 /vendor/magento/framework/Mail/Template/TransportBuilder.php(368): Magento\Email\Model\Template->setVars(NULL)
> #1 /vendor/magento/framework/Mail/Template/TransportBuilder.php(380): Magento\Framework\Mail\Template\TransportBuilder->getTemplate()
> #2 /vendor/magento/framework/Mail/Template/TransportBuilder.php(337): Magento\Framework\Mail\Template\TransportBuilder->prepareMessage()
> #3 /vendor/magento/module-sales/Model/Order/Email/SenderBuilder.php(91):
> Magento\Framework\Mail\Template\TransportBuilder->getTransport()
> #4 /vendor/magento/module-sal in /vendor/magento/module-email/Model/Template.php on line 403

Any ideas?

2 Answers 2


There are a number of reasons you can get this error

Misconfigured from address


Third party smtp extension causing issue. Raise with extension devs. Could be in relation to next point.

Problem with emails related to 2.3.3 release and extension email customisation. There is a patch to restore backwards compatibility.


Preview default behaviour is blank with few if no variables. It's basic. So that's not a clear indication of an issue.

Have you explored any of these already?

  • Thanks for your help, I have tried these now but still no progress. Might it be worth reverting to 2.3.2? Commented Nov 18, 2019 at 11:15
   $postObject = new \Magento\Framework\DataObject();
 $transport = $this->transportBuilder
                    ['area' => 'adminhtml','store' => $this->storeManager->getStore()->getId()])
                    ->setTemplateVars(['data' => $postObject])
                    ->setFrom(['name' => $senderName,'email' => $senderEmail])

use this ->setTemplateVars(['data' => $postObject])

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.