1個電子郵件地址2個主題和2個magento表單

[英]1 email address 2 subject and 2 forms in magento


I have an email address that is set for CONTACT US form and CUSTOM form (like WARRANTY form) that is created from CONTACT US form Multiple Contact Forms on Magento.

我有一個電子郵件地址設置為CONTACT US表單和CUSTOM表單(如WARRANTY表單),該表單是從聯系我們在Magento上的多個聯系表單創建的。

I want to separate this email with variant subject (when send email from contact us form subject should be contact and when send email from CUSTOM/WARRANTY form subject of email should be WARRANTY)

我想將此電子郵件與變體主題分開(當發送電子郵件時,請聯系我們表格主題應該是聯系人,當發送電子郵件來自CUSTOM / WARRANTY表單主題的電子郵件應該是保證)

What is the best solution for this? How do I do?

什么是最好的解決方案?我該怎么做?

2 个解决方案

#1


1  

For send Email to Multiple recipients in Contact Us Magento, you can tray this way.

要在聯系我們Magento中向多個收件人發送電子郵件,您可以通過這種方式托盤。

Step One, you can Find this line on app/code/core/Mage/Contacts/Controllers/IndexController.php

第一步,你可以在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)
                );

and modified to bellow :

並修改為以下:

                $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();
                }
         }
     }
}

And don't forget to comment validation javascript on app/code/core/Mage/Contacts/etc/system.xml

並且不要忘記在app / code / core / Mage / Contacts / etc / system.xml上評論驗證javascript

Find this line :

找到這一行:

<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>

Give comment to this line <validate>validate-email</validate>

對此行發表評論 validate-email

this code works for me in magento 1.7.0.2 . I hope this help your problem.. :D

這段代碼適用於magento 1.7.0.2。我希望這可以幫助你解決問題..:D

Don't forget to save and clear cache..

別忘了保存並清除緩存..

#2


0  

What you could do is add a hidden form field which contain the email subject.

您可以做的是添加一個包含電子郵件主題的隱藏表單字段。

Then go to admin -> Transaction Email and change the Template Subject to

然后轉到管理員 - >交易電子郵件並將模板主題更改為

{{var data.formsubject}}

{{var data.formsubject}}

Add a hidden field to each form

為每個表單添加一個隱藏字段

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

Read more @ Customizing Transactional Emails

閱讀更多@ Customizing Transactional Emails


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/11/21/7302b7c155e8d1bc694a00718f4df3dc.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com