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?
2 Answers
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('[email protected]','[email protected]'),
null,
array('data' => $postObject)
);
-
I also overrode the system.xml file in etc folder to remove the email-validation for the "recipient_email" field Jan 9, 2015 at 17:49
For remove validation from contact email option Please follow that tips
- Go here /app/code/core/Mage/Contacts/etc/system.xml
- find ,here section you will get validate tag and remove validate-email from validate tag.
You will be happy doing this because i have done same task using that.
-
1You shouldn't edit core. To override, see magento.stackexchange.com/a/9855/5390– HashidJun 27, 2016 at 7:13