在magento中如何在“联系我们”下的“电子邮件选项”中的“发送电子邮件到”字段中添加多个收件人

时间:2014-01-02 06:31:35

标签: magento email

在我的magento网站中,我需要将联系电子邮件发送给多个收件人。如何在电子邮件选项中发送电子邮件至字段中添加其他电子邮件ID。

2 个答案:

答案 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联系人模块以进行自定义。