Tuesday, August 17, 2010

Add CC to Contact Us in Magento Admin

Go to Admin Panel->System->Configuration->Contacts


Here in above screenshot you are able to see Send Email To in Email Options section.

· Now, if you want to add Send Email CC to this section, Open app\code\core\Mage\Contacts\etc\system.xml, and find below code,


<recipient_email translate="label">
<label>Send Emails To</label>
<frontend_type>text</frontend_type>
<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>
Add below code after above code in system.xml,


<recipient_email2 translate="label">
<label>Send Emails CC</label>
<frontend_type>text</frontend_type>
<sort_order>11</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</recipient_email2>


· Now open app\code\core\Mage\Contacts\controllers\IndexController.php & find below code,

const XML_PATH_EMAIL_RECIPIENT = 'contacts/email/recipient_email';

Add below code after above code,

const XML_PATH_EMAIL_RECIPIENT2 = 'contacts/email/recipient_email2';

Now find below code in same file IndexController.php,

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

);

Add below code after above code,

$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_RECIPIENT2),

null,

array('data' => $postObject)

);

Now finally you will have Send Email CC Field in Email Options, you can set different email address here & whenever user will fill contact us form in frontend Send Email CC will also receive an email for that contact inquiry.

No comments:

Post a Comment