1个电子邮件地址2个主题和2个magento表格

时间:2012-11-21 12:45:32

标签: forms magento contacts

我有一个电子邮件地址设置为CONTACT US表单和CUSTOM表单(如WARRANTY表单),该地址是从CONTACT US表单创建的 Multiple Contact Forms on Magento

我想将此电子邮件与变体主题分开(当发送电子邮件时,请联系我们表格主题应该是联系人,当发送电子邮件来自CUSTOM / WARRANTY表格主题应该是保证)

最佳解决方案是什么?我该怎么办?

2 个答案:

答案 0 :(得分:1)

要在联系我们Magento中向多个收件人发送电子邮件,您可以这样托盘。

第一步,你可以在app / code / core / Mage / Contacts / Controllers / IndexController.php上找到这一行

$mailTemplate = Mage::getModel('core/email_template');
            /* @var $mailTemplate Mage_Core_Model_Email_Template */
            $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)
                );

并修改为以下:

                $recipients = Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT);
                if ($recipients)
                {
                        $recipients = explode(";",$recipients);
                        if(count($recipients))
                        {
            foreach($recipients as $recipient) {

            $mailTemplate = Mage::getModel('core/email_template');
            /* @var $mailTemplate Mage_Core_Model_Email_Template */
            $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();
                }
         }
     }
}

并且不要忘记在app / code / core / Mage / Contacts / etc / system.xml上评论验证javascript

找到这一行:

<recipient_email translate="label">
    <label>Send Emails To</label>
    <frontend_type>text</frontend_type>
<!--<validate>validate-email</validate>-->
    <sort_order>10</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
</recipient_email>

对此行<validate>validate-email</validate>

发表评论

此代码适用于magento 1.7.0.2。我希望这可以帮助你解决问题......:D

不要忘记保存并清除缓存..

答案 1 :(得分:0)

您可以执行的操作是添加包含电子邮件主题的隐藏表单字段。

然后转到管理员 - &gt;交易电子邮件并将模板主题更改为

  

{{var data.formsubject}}

为每个表单添加隐藏字段

<input type="hidden" name="formsubject" value="Subject Here" />

了解更多@ Customizing Transactional Emails