Menu Close
    Hire Us Request Quote Reading List Switch to Dark Mode

    Magento2 – Create and Use Custom Email Templates

    Here will see how to create Email Templates in magento2.

    Email Templates in Magento2

    First create ’email_templates.xml’ file in folder ‘Webkul/Hello/etc’.

    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
    	<template id="hello_template" label="Hello World" file="hello.html" type="html" module="Webkul_Hello" area="frontend"/>
    </config>

    Now create email template file ‘hello.html’ in folder ‘Webkul/Hello/view/frontend/email’.

    <!--@subject Email Subject @-->
    <!--@vars
    {"store url=\"\"":"Store Url",
    "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
    @-->
    <!--@styles
    body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
    @-->
    {{template config_path="design/email/header_template"}}
    		<table cellspacing="0" cellpadding="0" border="0" width="100%">
    			<tr>
    				<td align="center" valign="top" style="padding:20px 0 20px 0">
    					<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
    						<tr>
    							<td valign="top">
    								<h1 style="font-size:22px;font-weight:normal;line-height:22px;margin:0 0 11px 0;">{{trans "Hello"}},</h1>
    							</td>
    						</tr>
    						<tr>
    							<td>
    								<table cellspacing="0" cellpadding="0" border="0" width="650">
    									<tbody>
    										<tr>
    											<td colspan="2" valign="top" style="font-size:12px;padding:7px 9px 9px 9px;border:1px solid #EAEAEA;">
    												{{var message}}
    											</td>
    										</tr>
    									</tbody>
    								</table>
    							</td>
    						</tr>
    						<tr>
    							<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA;text-align:center;">
    								<center>
    									<p style="font-size:12px;margin:0;">
    										<strong>{{trans "Thank you"}}</strong>
    									</p>
    								</center>
    							</td>
    						</tr>
    					</table>
    				</td>
    			</tr>
    		</table>
    	{{template config_path="design/email/footer_template"}}

     

    This is an example of template. you can set your own message body and can send as many as variable as you can.

    Now Call this template from where you want to call it.

    $templateOptions = array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $this->storeManager->getStore()->getId());
    $templateVars = array(
    					'store' => $this->storeManager->getStore(),
    					'customer_name' => 'John Doe',
    					'message'	=> 'Hello World!!.'
    				);
    $from = array('email' => "test@webkul.com", 'name' => 'Name of Sender');
    $this->inlineTranslation->suspend();
    $to = array('john@webkul.com');
    $transport = $this->_transportBuilder->setTemplateIdentifier('hello_template')
    				->setTemplateOptions($templateOptions)
    				->setTemplateVars($templateVars)
    				->setFrom($from)
    				->addTo($to)
    				->getTransport();
    $transport->sendMessage();
    $this->inlineTranslation->resume();

    $this->storeManager is instance of ‘Magento\Store\Model\StoreManagerInterface’

    $this->_transportBuilder is instance of ‘Magento\Framework\Mail\Template\TransportBuilder’

    $this->inlineTranslation is instance of ‘Magento\Framework\Translate\Inline\StateInterface’

    . . .

    Comments (7)

    Add Your Comment

  • dev Webwavers
    How is it possible to override custom email templates from backend?
    Please reply Webkul ?
  • Cero
    Hi is it possible to override the template from the backend?
    I tried to do it but it always send the template defined in the module
  • vishal
    Thanks for your help
  • dishank
    I solved This.
  • dishank
    when i add this code to my code and when i go to email template via(admin->smarketing->emailtemplates) it will give following error

    Warning: DOMDocument::loadXML(): XML declaration allowed only at the start of the document in Entity, line: 8 in D:xampphtdocsveng_msvendormagentoframeworkConfigDom.php on line 365
    #0 [internal function]: MagentoFrameworkAppErrorHandler->handler(2, ‘DOMDocument::lo…’, ‘D:\xampp\htdocs…’, 365, Array)
    #1 D:xampphtdocsveng_msvendormagentoframeworkConfigDom.php(365): DOMDocument->loadXML(‘_initDom(‘merge(‘_readFiles(Object(MagentoFrameworkConfigFileIterator))
    #5 D:xampphtdocsveng_msvendormagentoframeworkConfigData.php(91): MagentoFrameworkConfigReaderFilesystem->read()
    #6 D:xampphtdocsveng_msvendormagentoframeworkConfigData.php(80): MagentoFrameworkConfigData->initData()
    #7 D:xampphtdocsveng_msvendormagentomodule-emailModelTemplateConfigData.php(20): MagentoFrameworkConfigData->__construct(Object(MagentoEmailModelTemplateConfigReader), Object(MagentoFrameworkAppCacheTypeConfig), ’email_templates’)
    #8 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerFactoryAbstractFactory.php(99): MagentoEmailModelTemplateConfigData->__construct(Object(MagentoEmailModelTemplateConfigReader), Object(MagentoFrameworkAppCacheTypeConfig))
    #9 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerFactoryDynamicDeveloper.php(89): MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject(‘Magento\Email\M…’, Array)
    #10 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerObjectManager.php(71): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create(‘Magento\Email\M…’)
    #11 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerFactoryAbstractFactory.php(236): MagentoFrameworkObjectManagerObjectManager->get(‘Magento\Email\M…’)
    #12 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerFactoryDynamicDeveloper.php(53): MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgument(Array, ‘Magento\Email\M…’, NULL, ‘dataStorage’, ‘Magento\Email\M…’)
    #13 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerFactoryDynamicDeveloper.php(82): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->_resolveArguments(‘Magento\Email\M…’, Array, Array)
    #14 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerObjectManager.php(71): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create(‘Magento\Email\M…’)
    #15 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerFactoryAbstractFactory.php(236): MagentoFrameworkObjectManagerObjectManager->get(‘Magento\Email\M…’)
    #16 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerFactoryDynamicDeveloper.php(53): MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgument(Array, ‘Magento\Email\M…’, NULL, ’emailConfig’, ‘Magento\Email\M…’)
    #17 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerFactoryDynamicDeveloper.php(82): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->_resolveArguments(‘Magento\Email\M…’, Array, Array)
    #18 D:xampphtdocsveng_msvendormagentoframeworkObjectManagerObjectManager.php(57): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create(‘Magento\Email\M…’, Array)
    #19 D:xampphtdocsveng_msvendormagentoframeworkDataCollectionEntityFactory.php(37): MagentoFrameworkObjectManagerObjectManager->create(‘Magento\Email\M…’, Array)
    #20 D:xampphtdocsveng_msvendormagentoframeworkDataCollection.php(610): MagentoFrameworkDataCollectionEntityFactory->create(‘Magento\Email\M…’)
    #21 D:xampphtdocsveng_msvendormagentoframeworkDataCollectionAbstractDb.php(569): MagentoFrameworkDataCollection->getNewEmptyItem()
    #22 D:xampphtdocsveng_msvendormagentoframeworkDataCollectionAbstractDb.php(550): MagentoFrameworkDataCollectionAbstractDb->loadWithFilter(false, false)
    #23 D:xampphtdocsveng_msvendormagentoframeworkDataCollection.php(820): MagentoFrameworkDataCollectionAbstractDb->load()
    #24 D:xampphtdocsveng_msvendormagentomodule-backendviewadminhtmltemplateswidgetgridcolumn_set.phtml(53): MagentoFrameworkDataCollection->getIterator()
    #25 D:xampphtdocsveng_msvendormagentoframeworkViewTemplateEnginePhp.php(59): include(‘D:\xampp\htdocs…’)
    #26 D:xampphtdocsveng_msvendormagentoframeworkViewElementTemplate.php(255): MagentoFrameworkViewTemplateEnginePhp->render(Object(MagentoBackendBlockWidgetGridColumnSet), ‘D:/xampp/htdocs…’, Array)
    #27 D:xampphtdocsveng_msvendormagentoframeworkViewElementTemplate.php(279): MagentoFrameworkViewElementTemplate->fetchView(‘D:/xampp/htdocs…’)
    #28 D:xampphtdocsveng_msvendormagentoframeworkViewElementAbstractBlock.php(657): MagentoFrameworkViewElementTemplate->_toHtml()
    #29 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(542): MagentoFrameworkViewElementAbstractBlock->toHtml()
    #30 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(518): MagentoFrameworkViewLayout->_renderBlock(‘adminhtml.syste…’)
    #31 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘adminhtml.syste…’)
    #32 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘adminhtml.syste…’)
    #33 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘adminhtml.syste…’, true)
    #34 D:xampphtdocsveng_msvendormagentoframeworkViewElementAbstractBlock.php(497): MagentoFrameworkViewLayoutInterceptor->renderElement(‘adminhtml.syste…’, true)
    #35 D:xampphtdocsveng_msvendormagentomodule-backendviewadminhtmltemplateswidgetgrid.phtml(133): MagentoFrameworkViewElementAbstractBlock->getChildHtml(‘grid.columnSet’)
    #36 D:xampphtdocsveng_msvendormagentoframeworkViewTemplateEnginePhp.php(59): include(‘D:\xampp\htdocs…’)
    #37 D:xampphtdocsveng_msvendormagentoframeworkViewElementTemplate.php(255): MagentoFrameworkViewTemplateEnginePhp->render(Object(MagentoBackendBlockWidgetGrid), ‘D:/xampp/htdocs…’, Array)
    #38 D:xampphtdocsveng_msvendormagentoframeworkViewElementTemplate.php(279): MagentoFrameworkViewElementTemplate->fetchView(‘D:/xampp/htdocs…’)
    #39 D:xampphtdocsveng_msvendormagentomodule-backendBlockTemplate.php(104): MagentoFrameworkViewElementTemplate->_toHtml()
    #40 D:xampphtdocsveng_msvendormagentoframeworkViewElementAbstractBlock.php(657): MagentoBackendBlockTemplate->_toHtml()
    #41 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(542): MagentoFrameworkViewElementAbstractBlock->toHtml()
    #42 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(518): MagentoFrameworkViewLayout->_renderBlock(‘adminhtml.syste…’)
    #43 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘adminhtml.syste…’)
    #44 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘adminhtml.syste…’)
    #45 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘adminhtml.syste…’, true)
    #46 D:xampphtdocsveng_msvendormagentoframeworkViewElementAbstractBlock.php(497): MagentoFrameworkViewLayoutInterceptor->renderElement(‘adminhtml.syste…’, true)
    #47 D:xampphtdocsveng_msvendormagentomodule-emailviewadminhtmltemplatestemplatelist.phtml(11): MagentoFrameworkViewElementAbstractBlock->getChildHtml(‘grid’)
    #48 D:xampphtdocsveng_msvendormagentoframeworkViewTemplateEnginePhp.php(59): include(‘D:\xampp\htdocs…’)
    #49 D:xampphtdocsveng_msvendormagentoframeworkViewElementTemplate.php(255): MagentoFrameworkViewTemplateEnginePhp->render(Object(MagentoEmailBlockAdminhtmlTemplate), ‘D:/xampp/htdocs…’, Array)
    #50 D:xampphtdocsveng_msvendormagentoframeworkViewElementTemplate.php(279): MagentoFrameworkViewElementTemplate->fetchView(‘D:/xampp/htdocs…’)
    #51 D:xampphtdocsveng_msvendormagentomodule-backendBlockTemplate.php(104): MagentoFrameworkViewElementTemplate->_toHtml()
    #52 D:xampphtdocsveng_msvendormagentoframeworkViewElementAbstractBlock.php(657): MagentoBackendBlockTemplate->_toHtml()
    #53 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(542): MagentoFrameworkViewElementAbstractBlock->toHtml()
    #54 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(518): MagentoFrameworkViewLayout->_renderBlock(‘adminhtml.syste…’)
    #55 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘adminhtml.syste…’)
    #56 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘adminhtml.syste…’)
    #57 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘adminhtml.syste…’, true)
    #58 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(569): MagentoFrameworkViewLayoutInterceptor->renderElement(‘adminhtml.syste…’)
    #59 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(520): MagentoFrameworkViewLayout->_renderContainer(‘content’)
    #60 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘content’)
    #61 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘content’)
    #62 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘content’, true)
    #63 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(569): MagentoFrameworkViewLayoutInterceptor->renderElement(‘content’)
    #64 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(520): MagentoFrameworkViewLayout->_renderContainer(‘main.col’)
    #65 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘main.col’)
    #66 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘main.col’)
    #67 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘main.col’, true)
    #68 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(569): MagentoFrameworkViewLayoutInterceptor->renderElement(‘main.col’)
    #69 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(520): MagentoFrameworkViewLayout->_renderContainer(‘admin.scope.col…’)
    #70 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘admin.scope.col…’)
    #71 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘admin.scope.col…’)
    #72 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘admin.scope.col…’, true)
    #73 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(569): MagentoFrameworkViewLayoutInterceptor->renderElement(‘admin.scope.col…’)
    #74 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(520): MagentoFrameworkViewLayout->_renderContainer(‘page.main.conta…’)
    #75 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘page.main.conta…’)
    #76 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘page.main.conta…’)
    #77 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘page.main.conta…’, true)
    #78 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(569): MagentoFrameworkViewLayoutInterceptor->renderElement(‘page.main.conta…’)
    #79 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(520): MagentoFrameworkViewLayout->_renderContainer(‘page.content’)
    #80 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘page.content’)
    #81 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘page.content’)
    #82 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘page.content’, true)
    #83 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(569): MagentoFrameworkViewLayoutInterceptor->renderElement(‘page.content’)
    #84 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(520): MagentoFrameworkViewLayout->_renderContainer(‘page.wrapper’)
    #85 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘page.wrapper’)
    #86 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘page.wrapper’)
    #87 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘page.wrapper’, true)
    #88 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(569): MagentoFrameworkViewLayoutInterceptor->renderElement(‘page.wrapper’)
    #89 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(520): MagentoFrameworkViewLayout->_renderContainer(‘backend.page’)
    #90 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘backend.page’)
    #91 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘backend.page’)
    #92 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘backend.page’, true)
    #93 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(569): MagentoFrameworkViewLayoutInterceptor->renderElement(‘backend.page’)
    #94 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(520): MagentoFrameworkViewLayout->_renderContainer(‘root’)
    #95 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘root’)
    #96 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(472): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘root’)
    #97 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘root’, true)
    #98 D:xampphtdocsveng_msvendormagentoframeworkViewLayout.php(938): MagentoFrameworkViewLayoutInterceptor->renderElement(‘root’)
    #99 D:xampphtdocsveng_msvargenerationMagentoFrameworkViewLayoutInterceptor.php(492): MagentoFrameworkViewLayout->getOutput()
    #100 D:xampphtdocsveng_msvendormagentoframeworkViewResultPage.php(241): MagentoFrameworkViewLayoutInterceptor->getOutput()
    #101 D:xampphtdocsveng_msvendormagentoframeworkViewResultLayout.php(162): MagentoFrameworkViewResultPage->render(Object(MagentoFrameworkAppResponseHttpInterceptor))
    #102 D:xampphtdocsveng_msvargenerationMagentoBackendModelViewResultPageInterceptor.php(193): MagentoFrameworkViewResultLayout->renderResult(Object(MagentoFrameworkAppResponseHttpInterceptor))
    #103 D:xampphtdocsveng_msvendormagentoframeworkAppView.php(221): MagentoBackendModelViewResultPageInterceptor->renderResult(Object(MagentoFrameworkAppResponseHttpInterceptor))
    #104 D:xampphtdocsveng_msvendormagentomodule-emailControllerAdminhtmlEmailTemplateIndex.php(27): MagentoFrameworkAppView->renderLayout()
    #105 D:xampphtdocsveng_msvargenerationMagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor.php(25): MagentoEmailControllerAdminhtmlEmailTemplateIndex->execute()
    #106 D:xampphtdocsveng_msvendormagentoframeworkAppActionAction.php(102): MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor->execute()
    #107 D:xampphtdocsveng_msvendormagentomodule-backendAppAbstractAction.php(226): MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
    #108 [internal function]: MagentoBackendAppAbstractAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
    #109 D:xampphtdocsveng_msvendormagentoframeworkInterceptionInterceptor.php(74): call_user_func_array(Array, Array)
    #110 D:xampphtdocsveng_msvendormagentoframeworkInterceptionChainChain.php(70): MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor->___callParent(‘dispatch’, Array)
    #111 D:xampphtdocsveng_msvendormagentoframeworkInterceptionChainChain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext(‘Magento\Email\C…’, ‘dispatch’, Object(MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor), Array, ‘adminAuthentica…’)
    #112 D:xampphtdocsveng_msvendormagentomodule-backendAppActionPluginAuthentication.php(143): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChain{closure}(Object(MagentoFrameworkAppRequestHttp))
    #113 [internal function]: MagentoBackendAppActionPluginAuthentication->aroundDispatch(Object(MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
    #114 D:xampphtdocsveng_msvendormagentoframeworkInterceptionChainChain.php(67): call_user_func_array(Array, Array)
    #115 D:xampphtdocsveng_msvendormagentoframeworkInterceptionChainChain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext(‘Magento\Email\C…’, ‘dispatch’, Object(MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor), Array, ‘designLoader’)
    #116 D:xampphtdocsveng_msvendormagentoframeworkAppActionPluginDesign.php(39): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChain{closure}(Object(MagentoFrameworkAppRequestHttp))
    #117 [internal function]: MagentoFrameworkAppActionPluginDesign->aroundDispatch(Object(MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
    #118 D:xampphtdocsveng_msvendormagentoframeworkInterceptionChainChain.php(67): call_user_func_array(Array, Array)
    #119 D:xampphtdocsveng_msvendormagentoframeworkInterceptionInterceptor.php(136): MagentoFrameworkInterceptionChainChain->invokeNext(‘Magento\Email\C…’, ‘dispatch’, Object(MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor), Array, ‘adminMassaction…’)
    #120 D:xampphtdocsveng_msvendormagentomodule-backendAppActionPluginMassactionKey.php(33): MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
    #121 [internal function]: MagentoBackendAppActionPluginMassactionKey->aroundDispatch(Object(MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
    #122 D:xampphtdocsveng_msvendormagentoframeworkInterceptionInterceptor.php(140): call_user_func_array(Array, Array)
    #123 D:xampphtdocsveng_msvargenerationMagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor.php(40): MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor->___callPlugins(‘dispatch’, Array, Array)
    #124 D:xampphtdocsveng_msvendormagentoframeworkAppFrontController.php(55): MagentoEmailControllerAdminhtmlEmailTemplateIndexInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
    #125 [internal function]: MagentoFrameworkAppFrontController->dispatch(Object(MagentoFrameworkAppRequestHttp))
    #126 D:xampphtdocsveng_msvendormagentoframeworkInterceptionInterceptor.php(74): call_user_func_array(Array, Array)
    #127 D:xampphtdocsveng_msvendormagentoframeworkInterceptionChainChain.php(70): MagentoFrameworkAppFrontControllerInterceptor->___callParent(‘dispatch’, Array)
    #128 D:xampphtdocsveng_msvendormagentoframeworkInterceptionInterceptor.php(136): MagentoFrameworkInterceptionChainChain->invokeNext(‘Magento\Framewo…’, ‘dispatch’, Object(MagentoFrameworkAppFrontControllerInterceptor), Array, ‘install’)
    #129 D:xampphtdocsveng_msvendormagentoframeworkModulePluginDbStatusValidator.php(69): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
    #130 [internal function]: MagentoFrameworkModulePluginDbStatusValidator->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
    #131 D:xampphtdocsveng_msvendormagentoframeworkInterceptionInterceptor.php(140): call_user_func_array(Array, Array)
    #132 D:xampphtdocsveng_msvargenerationMagentoFrameworkAppFrontControllerInterceptor.php(26): MagentoFrameworkAppFrontControllerInterceptor->___callPlugins(‘dispatch’, Array, Array)
    #133 D:xampphtdocsveng_msvendormagentoframeworkAppHttp.php(115): MagentoFrameworkAppFrontControllerInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
    #134 D:xampphtdocsveng_msvendormagentoframeworkAppBootstrap.php(258): MagentoFrameworkAppHttp->launch()
    #135 D:xampphtdocsveng_msindex.php(42): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttp))
    #136 {main}

  • vishal
    Hi Can you tell mw how to add custom subject in template file?
    • Rahul
      You can pass variables from code and can use it as subject in email template.
      pass variable customSubject in $templateVars and use it directly in subject.

      $templateVars = array(
      ‘store’ => $this->storeManager->getStore(),
      ‘customer_name’ => ‘John Doe’,
      ‘message’ => ‘Hello World!!.’,
      ‘customSubject’ => ‘custom subject’
      );
      use it in email template
      see screenshot
      http://i.imgur.com/OlMc6dl.png

      Thanks

  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close