How to Add CC in Contact Us in Magento



In this post I am explaining simple code tricks to add CC in contact us email in Magento Admin under the Email Options of Contacts menu. You can add any email that you want for contact us  CC email address. To see CC email address field go to System -> Configuration -> General -> Contacts and you will see Send Emails CC in Contacts -> Email Options section. So you can add CC in contact us using following steps.

Go to app\code\core\Mage\Contacts\etc and open system.xml file and find below code at around line no 67

<recipient_email translate="label">
	<label>Send Emails To</label>
	<frontend_type>text</frontend_type>
	<validate>validate-email required-entry</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>

Now Add below code just after this block:

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

Now go to app\code\core\Mage\Contacts\controllers and open IndexController.php file and find below code at around line no 37

const XML_PATH_EMAIL_RECIPIENT  = 'contacts/email/recipient_email';

Add below code just after this

### CC ###
const XML_PATH_EMAIL_RECIPIENT_CC  = 'contacts/email/recipient_emailcc';

Now find below code in IndexController.php at around line no 99

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

Now after this code add below code block to send mail to CC email address

################# Send mail to CC #################
$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_CC),
		null,
		array('data' => $postObject)
	);

Finally you will see the Send Emails CC field in Email options section of contacts like below.

 

How to Add CC in Contact Us in Magento
How to Add CC in Contact Us in Magento

 

Here you can add your CC email address to send a CC of the contact us email. Hope this will help you.