How to diagnose the «We're sorry, an error has occurred while generating this email» failure

As you can see from the code:

  1. The exception is occured while executing the \Magento\Framework\Filter\Template::filter() method
  • The error could be not related to a email (the poor message is a Magento 2 issue), but related to a {{}} CMS directive.
  • You can enable the developer mode to get the actual exception’s message on the screen instead of the poor generic message.
  • You can also see the actual exception’s message in the exception log file.