在我的magento网站中,我需要将联系电子邮件发送给多个收件人。如何在电子邮件选项中发送电子邮件至字段中添加其他电子邮件ID。
答案 0 :(得分:2)
1)进入系统>配置>联系人并在“发送电子邮件至”字段中以逗号分隔添加您的电子邮件ID(例如:test @ gmail.com,user1 @ gmail.com.user2 @ gmail.com)
将 code / core / Mage / Contacts / controllers / IndexController.php 中的文件复制到本地,例如 code / local / Mage / Contacts / controllers / IndexController.php 或根据您的要求制作Custom Module
。
在 postAction 中,您应该找到几行代码:
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
->setReplyTo($post['email'])
->sendTransactional(
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
null,
array('data' => $postObject)
);
if (!$mailTemplate->getSentSuccess()) {
throw new Exception();
}
将其更改为:
$recipients = explode(",",Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT));
foreach($recipients as $recipient){
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
->setReplyTo($post['email'])
->sendTransactional(
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
$recipient,
null,
array('data' => $postObject)
);
if (!$mailTemplate->getSentSuccess()) {
throw new Exception();
}
}
答案 1 :(得分:1)
如果是强制性要求,则无法通过magento的admin部分执行此操作,然后您需要覆盖magento联系人模块以进行自定义。