当我从magento的root脚本发送电子邮件时,我收到以下错误。
Fatal error: Uncaught exception 'BadMethodCallException' with message 'Missing required argument $debugHintsPath of Magento\Developer\Model\TemplateEngine\Plugin\DebugHints.' in /var/www/html/2x/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:45
Stack trace:
0 /var/www/html/2x/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Develop...', Array, Array)
1 /var/www/html/2x/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Develop...')
2 /var/www/html/2x/vendor/magento/framework/Interception/PluginList/PluginList.php(234): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Develop...')
3 /var/www/html/2x/vendor/magento/framework/Interception/Interceptor.php(149): Magento\Framework\Interception\PluginList\PluginList->getPlugin('Magento\\Framewo...', 'debug_hints')
4 /var/www/html/2x/var/generati in /var/www/html/2x/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 45
以下是我使用的代码。
$orderid = '000000003';
$order = $obj->create('Magento\Sales\Model\Order')->loadByIncrementId($orderid);
// print_r($order->getData());
$obj->create('Magento\Sales\Model\Order\Email\Sender\OrderSender')->send($order,true);
请帮我解决这个问题。
答案 0 :(得分:4)
尝试使用
$orderid = '000000003';
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->loadByIncrementId($orderid);
$objectManager->create('Magento\Sales\Model\OrderNotifier')->notify($order);
答案 1 :(得分:2)
如果需要,您还可以更改邮件的收件人:
$orderid = '000000338';
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->loadByIncrementId($orderid);
$order->setCustomerEmail('custom@mail.com');
$objectManager->create('Magento\Sales\Model\OrderNotifier')->notify($order);