我正在处理涉及一些敏感信息的magento项目,所以在询问更多信息之前请记住这一点。
基本上,我尝试将两封不同模板的电子邮件发送到两个不同的地址。我遵循了inchoo网站上的教程(关于使用模板的教程,因为模板是自定义模板)。
为了更清楚地了解这个主题,我在装载两个顾客时(想想他们是买家和卖家),当买家做他应该做的事情,IE,买,卖家收到一封电子邮件说买家想要他这样。与此同时,买家也收到一封电子邮件,说他发起了购买程序,他应该等待卖家的回复。 因此,在上面的示例中,卖家收到电子邮件,然后买家收到他的电子邮件,但也收到了卖家的电子邮件。我需要在正确的方向上轻推以保持电子邮件的清晰。
感谢您对我的感谢,并提前感谢我收到的任何回复。
编辑添加完整代码
$ worker = Mage :: getSingleton('客户/客户') - >加载($ owner);
$customer = Mage::getSingleton('customer/customer')->load($customer);
$customerAddress = Mage::getSingleton('customer/address')->load($customer->getDefaultBilling())->format('html');
$emailTemplate = Mage::getSingleton('core/email_template')->loadDefault('airhotels_worker_email_notification_template');
$emailTemplateVariables = array();
$emailTemplateVariables['worker'] = $worker->getFirstname() . ' ' . $worker->getLastname();
$emailTemplateVariables['date'] = date('Y-m-d', strtotime($start));
$emailTemplateVariables['start'] = date('H:i:s', strtotime($start));
$emailTemplateVariables['end'] = date('H:i:s', strtotime($end));
$emailTemplateVariables['account'] = Mage::getUrl('custom/mycontroller/jobs');
$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
$emailTemplate->setSenderName($senderName);
$emailTemplate->setSenderEmail($senderEmail);
$emailTemplate->setTemplateSubject('A new order for your services');
$emailTemplate->send($worker->getEmail(), $worker->getFirstname() . ' ' . $worker->getLastname(), $emailTemplateVariables);
unset($emailTemplate);
unset($emailTemplateVariables);
unset($processedTemplate);
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('airhotels_customer_email_notification_template');
$emailTemplateVariables = array();
$emailTemplateVariables['customer'] = $customer->getFirstname() . ' ' . $customer->getLastname();
$emailTemplateVariables['worker'] = $worker->getFirstname() . ' ' . $worker->getLastname();
$emailTemplateVariables['date'] = date('Y-m-d', strtotime($start));
$emailTemplateVariables['start'] = date('H:i:s', $start);
$emailTemplateVariables['end'] = date('H:i:s', $end);
$emailTemplateVariables['worker_address'] = Mage::getModel('customer/address')->load($worker->getDefaultBilling())->format('html');
$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
$emailTemplate->setSenderName($senderName);
$emailTemplate->setSenderEmail($senderEmail);
$emailTemplate->setTemplateSubject('You have placed a new order');
$emailTemplate->send($customer->getEmail(), $customer->getFirstname() . ' ' . $customer->getLastname(), $emailTemplateVariables);
unsets只是我试图解决的问题。