Closed
Description
Preconditions
- Tested on Magento CE 2.1.3 with PHP 7
Steps to reproduce
- Create a custom controller, sending a custom mail, mostly like this
- Make a mistake in the template file name
- Try to send the mail
Expected result
- The mail is correctly sent with content
Actual result
- The mail is correctly sent but the body is empty
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
- Go to file
app/code/Magento/Customer/etc/email_templates.xml
- Make a mistake in the template file name: replace from
account_new.html
toaccount_new1.html
in tag:
...
<template id="customer_create_account_email_template" label="New Account" file="account_new1.html" type="html" module="Magento_Customer" area="frontend"/>
...
- Create new customer on frontend
Expected result
- The email about new customer not sent.
- Exception like "Can not find the file account_new1.htm" is present in logs
Actual result
- The mail is correctly sent but the body is empty
- Any exception is absent in logs.
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.2 release lineGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.3 release