To send email to multiple recipients in Contact Us Magento, you can tray this way.
Step one, you can find this line in the /code/core/Mage/Contacts/Controllers/IndexController.php application
$mailTemplate = Mage::getModel('core/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 below:
$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'); $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 on javascript validation on app / code / core / Mage / Contacts / etc / system.xml
Find this line:
<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>
Comment on this line <validate>validate-email</validate>
this code works for me in magento 1.7.0.2. Hope this helps your problem ..: D
Remember to save and clear the cache.
source share