我爲自定義模塊創建了一個電子郵件模板。Magento核心/ email_template_mailer不發送自定義模塊的郵件
對於這種情況,它使用core/email_template_mailer
(Mage::getModel('core/email_template_mailer');
),它也有html模板。但它不工作;
這裏定義的config.xml
<template>
<email>
<vendor_create_account_email_template translate="label" module="vendor">
<label>New account</label>
<file>vendor_account_new.html</file>
<type>html</type>
</vendor_create_account_email_template>
</email>
</template>
喜愛
HTML模板我已創建自定義模塊一個電子郵件模板。
對於這種情況,它有使用核心/ email_template_mailer(法師:: getModel('核心/ email_template_mailer');),它也有HTML模板。但它不工作;
這裏定義config.xml中的模板HTML
新帳戶 vendor_account_new.html HTML
和郵件發送代碼
$vednor=Mage::getModel('vendor/vendor')->load(66);
/** @var $mailer Mage_Core_Model_Email_Template_Mailer */
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($vednor->getEmail(), $vednor->getName());
$mailer->addEmailInfo($emailInfo);
// Set all required params and send emails
$mailer->setSender('[email protected]');
$mailer->setStoreId(1);
$mailer->setTemplateId('vendor_create_account_email_template');
$mailer->setTemplateParams(array('vendor' => $vednor));
$mailer->send();
而且在vendor_account_new.html代碼
<[email protected] Welcome, {{var vendor.name}}! @-->
<[email protected]
{"store url=\"\"":"Store Url",
"var logo_url":"Email Logo Image Url",
"htmlescape var=vendor.name":"Customer Name",
"store url=\"customer/account/\"":"Customer Account Url",
"var vendor.email":"Customer Email",
"htmlescape var=$customer.password":"Customer Password"}
@-->
<[email protected]
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
@-->
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
<tr>
<td align="center" valign="top" style="padding:20px 0 20px 0">
<!-- [ header starts here] -->
<table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
<tr>
<td valign="top">
<a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
</tr>
<!-- [ middle starts here] -->
<tr>
<td valign="top">
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Dear {{htmlescape var=$vendor.name}},</h1>
<p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Welcome to {{var store.getFrontendName()}}. To log in when visiting our site just click <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">Login</a> or <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">My Account</a> at the top of every page, and then enter your e-mail address and password.</p>
<p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0; padding:13px 18px; background:#f9f9f9;">
Use the following values when prompted to log in:<br/>
<strong>E-mail</strong>: {{var vendor.email}}<br/>
<strong>Password</strong>: {{htmlescape var=$vendor.password}}<p>
<p style="font-size:12px; line-height:16px; margin:0 0 8px 0;">When you log in to your account, you will be able to do the following:</p>
<ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;">
<li style="list-style:none inside; padding:0 0 0 10px;">– Proceed through checkout faster when making a purchase</li>
<li style="list-style:none inside; padding:0 0 0 10px;">– Check the status of orders</li>
<li style="list-style:none inside; padding:0 0 0 10px;">– View past orders</li>
<li style="list-style:none inside; padding:0 0 0 10px;">– Make changes to your account information</li>
<li style="list-style:none inside; padding:0 0 0 10px;">– Change your password</li>
<li style="list-style:none inside; padding:0 0 0 10px;">– Store alternative addresses (for shipping to multiple family members and friends!)</li>
</ul>
<p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p>
</td>
</tr>
<tr>
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
任何一個可以告訴我,有什麼問題...
kingshuk,我KHOW這個thing.but,我想用核發送郵件/ email_template_mailer。 –
你爲什麼要堅持core_template_mailer?是否有任何具體的原因..BTW FYI我也使用自定義模塊這裏是自定義的電子郵件模板,這也是HTML。 –
Magento有使用該功能。爲什麼我不能使用它? –