我在magento中创建了一个名为vendor Complaints的自定义模块。供应商用户可以向管理员发送有关其投诉的邮件,管理员可以向该特定供应商用户发送回复邮件。所以我创建了两个不同的邮件模板,但我不知道如何一次发送两个邮件模板。
现在我已经完成向供应商用户发送回复电子邮件,但我还没有向管理员用户发送邮件。
我向供应商用户发送回复邮件的代码:
/**sending email*/
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('vendor_complaints_email_template');
//Getting the Store E-Mail Sender Name.
$senderName = Mage::getStoreConfig('trans_email/ident_general/name');
//Getting the Store General E-Mail.
$senderEmail = Mage::getStoreConfig('trans_email/ident_general/email');
//Variables for Confirmation Mail.
$emailTemplateVariables = array();
$emailTemplateVariables['name'] = $customerName;
$emailTemplateVariables['email'] = $customerEmail;
//Appending the Custom Variables to Template.
$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
//Sending E-Mail to Customers.
$mail = Mage::getModel('core/email')
->setToName($customerName)
->setToEmail($customerEmail)
->setBody($processedTemplate)
->setSubject('ShopU Store : Vendor Complaints')
->setFromEmail($senderEmail)
->setFromName($senderName)
->setType('html');
//echo "<pre>";
//print_r($mail);
//die;
try{
//Confimation E-Mail Send
$mail->send();
}
catch(Exception $error)
{
Mage::getSingleton('core/session')->addError($error->getMessage());
return false;
}
/**end**/
有人能告诉我如何一次向管理员用户发送邮件???
提前致谢..
答案 0 :(得分:0)
你可以巩固这个,但是:
//Sending E-Mail to Customers.
$mail = Mage::getModel('core/email')
->setToName($customerName)
->setToEmail($customerEmail)
->setBody($processedTemplate)
->setSubject('ShopU Store : Vendor Complaints')
->setFromEmail($senderEmail)
->setFromName($senderName)
->setType('html');
try{
//Confimation E-Mail Send
$mail->send();
}
catch(Exception $error)
{
Mage::getSingleton('core/session')->addError($error->getMessage());
return false;
}
//Sending E-Mail to Admin.
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('vendor_complaints_email_template_for_admin');
$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
$adminMail = Mage::getModel('core/email')
->setToName('Admin Name')
->setToEmail('admin@something.com')
->setBody($processedTemplate)
->setSubject('ShopU Store : Vendor Complaints')
->setFromEmail($senderEmail)
->setFromName($senderName)
->setType('html');
try{
//Confimation E-Mail Send
$adminMail->send();
}
catch(Exception $error)
{
Mage::getSingleton('core/session')->addError($error->getMessage());
return false;
}