![](/img/trans.png)
[英]How to Add Custom Attribute on product Grid in magento 1.9.2 community edition
[英]Not able to send email using custom template in magento 1.9.2 community edition
大家好,我正嘗試使用自定義電子郵件模板在magento中發送電子郵件。 但是我遇到了例外,我已經安裝了SMTP Pro Extension。
我在這里列出代碼:-
我的config.xml
<template>
<email>
<custom_abc_email_template module="custom_abc">
<label>Custom Template</label>
<file>custom_abc_templates/customTemplate.html</file> // this specifies the path where the custom template is located
<type>html</type>
</custom_abc_email_template>
</email>
</template>
我的控制器動作代碼
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('custom_abc_email_template');
$emailTemplate->setSenderName('custom template');
$emailTemplate->setSenderEmail('abc@demomail.com');
$emailTemplate->send('abc@demomail.com','Forgot Password');
我的模板文件代碼
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="action-content">
<h1>Custom Abc,</h1>
<p><strong>Your new password is:</strong> trolled</p>
<p>You can change your password at any time by logging into <a href="{{store url="customer/account/"}}">your account</a>.</p>
</td>
</tr>
</table>
在exception.log
2016-04-11T10:03:18+00:00 ERR (3): exception 'Exception' with message
'This letter cannot be sent.' in /var/www/html/MMM/app/code/local/Aschroder/SMTPPro/Model/Email/Template.php:40
在aschroder_smtppro.log中
2016-04-11T10:03:18+00:00 DEBUG (7): Email is not valid for sending,
this is a core error that often means there's a problem with your email templates.
使用這個模板
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="action-content">
<h1>Custom Abc,</h1>
<p><strong>Your new password is:</strong> trolled</p>
<p>You can change your password at any time by logging into <a href="{{store url='customer/account/'}}">your account</a>.</p>
</td>
</tr>
解決了與Magento系統電子郵件設置更改相同的異常。 例外是在插件的電子郵件模板代碼中設置的(請參見下文)。
在管理中,從頂部菜單中選擇系統->配置,然后轉到系統-郵件發送設置。 將“禁用電子郵件通信”設置為“否”。
if (!$this->isValidForSend()) {
$_helper->log('Email is not valid for sending, this is a core error that often means there\'s a problem with your email templates.');
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
return false; }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.