-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Silent error when an email template is not found #8437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@shavounet I see the following code in the logic of the filesystem adapter which should throw an exception in case if you misspelled the name of the file: |
I don't have much time to test it again, but here is the main method. /**
* Send the quote email
* @param Quote $quote
* @throws \Exception
*/
public function sendNewQuoteEmail($quote)
{
$this->inlineTranslation->suspend();
$receiverEmail = $this->scopeConfig->getValue('vendor_personalization/quote/contact_email', ScopeInterface::SCOPE_STORES);
if(empty($receiverEmail)) {
throw new \Exception('The receiver email is undefined in Vendor configuration');
}
$this->transportBuilder
// Set required data
->setTemplateIdentifier('vendor_pms_new_quote')
->setTemplateOptions([
'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
'store' => $this->storeManager->getStore()->getId()
])
->setTemplateVars(['quote' => $quote])
->setFrom([
'name' => $quote->getFullName(),
'email' => $quote->getEmail(),
])
->addTo($receiverEmail)
// Send message
->getTransport()
->sendMessage();
$this->inlineTranslation->resume();
} |
@shavounet thank you let me try |
@shavounet , thank you for your report. |
Hello @magento-engcom-team, Maybe there is some side effect with other methods ? (getScheme, getAbsolutePath, ...) If you look at those examples, some case (2nd and 3rd) can be problematic :
|
Update description: Preconditions
Steps to reproduce
Expected result
Actual result
IMO, If it matters, my send code in the controller was followed by a redirect (after filling a form). Best way to reproduce
Expected result
Actual result
|
@shavounet, thank you for your report. |
Hi @shavounet |
Uh oh!
There was an error while loading. Please reload this page.
Preconditions
Steps to reproduce
Expected result
Actual result
IMO,
\Magento\Email\Model\AbstractTemplate::loadDefault
should throw an error (or at least log an error message...), when the file is not found. In this case$rootDirectory->getRelativePath($templateFile)
returns an empty string and so does$rootDirectory->readFile('')
... Maybe the problem is deeper, but a silent error should not happen.If it matters, my send code in the controller was followed by a redirect (after filling a form).
Best way to reproduce
app/code/Magento/Customer/etc/email_templates.xml
account_new.html
toaccount_new1.html
in tag:Expected result
Actual result
The text was updated successfully, but these errors were encountered: