Magento 1.9 – Contact Form Emails to Multiple Recipients

contact-usmagento-1.9

I am trying to find a way to send emails sent by the contact form to multiple email addresses but all the solutions I found involve the edit of the core files and I would like to avoid it. I think that the best way would to extend the contact form but I have no idea on how to do that. Anyone has a clue on how to do that?

Best Answer

If you check the IndexController.php in the Contacts module, you'll see a ->sendTransactional line in the postAction() method.

The 3rd parameter (Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT)) can be an array of email addresses.

So the only thing you need to do is extend the controller (how to do this can be found here for example: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller

And then add multiple email address to your sendTransactional code:

$mailTemplate->setDesignConfig(array('area' => 'frontend'))
                    ->setReplyTo($post['email'])
                    ->sendTransactional(
                        Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
                        Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
                        array('emailone@domain.com','emailtwo@domain.com'),
                        null,
                        array('data' => $postObject)
                    );
Related Topic