3

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?

5

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)
                    );
  • I also overrode the system.xml file in etc folder to remove the email-validation for the "recipient_email" field – gianis6 Jan 9 '15 at 17:49
0

For remove validation from contact email option Please follow that tips

  1. Go here /app/code/core/Mage/Contacts/etc/system.xml
  2. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.