Rama Priya
Rama Priya

Reputation: 2507

In magento how to add multiple recipients to 'Send Emails to' field in Email Options under contact Us

In my magento site i need to send the contact email to more than one recipient.How to add additional email id in Send Emails to field in Email options.

Upvotes: 1

Views: 8706

Answers (2)

Slimshadddyyy
Slimshadddyyy

Reputation: 4081

1) Go to System > Configuration > Contacts and add your Email-id’s in comma delimit in “Send Emails To” field (eg: [email protected],[email protected]@gmail.com)

Copy file from code/core/Mage/Contacts/controllers/IndexController.php into your local like code/local/Mage/Contacts/controllers/IndexController.php or make your Custom Module depending upon your requirement.

In postAction you should find a few lines of code that look like this:

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

Change it to below:

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

Upvotes: 2

Saurabh
Saurabh

Reputation: 368

There is no way to do it through admin section of magento if is it your mandatory requirement then you need to override the magento contact module for customization.

Upvotes: 1

Related Questions