First off, forgive my lack of knowledge in php, that is a world I have yet to really delve into! So, I am trying to use the contact form while giving the user the opportunity to select which part of the company to contact. Moreover, instead of sending to [email protected], [email protected], [email protected].. I am trying to have them select via a select box to email [email protected] with Form1, [email protected] with Form2, and so on.

I have created a select box that hides and shows different forms within the contact form page, and I have located the indexController.php (Mage/Contacts/controllers/IndexController.php) where the form action is being used. I have also seen where the recipient can be changed, my only confusion is to what exactly I could duplicate to get this desired effect to work all on the same page.

I believe the form is being called via

<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">

Which directs to the indexController.php, and I have found help that would allow me to change and send the email to multiple recipients, but my goal is to send to a single recipient, but have multiple instances of the form.

I imagine I would want to have multiple instances of postAction but unsure where to relabel them/call them in the form.phtml to allow for the different locations.

1 Answer 1


First of all, you will need a custom extension for this. Don't change anything in the core of Magento.

To get this done, my idea would be to add a field to your form with the email addresses you want them to send to. Then, in the section where Magento is sending the email, you need to read the selected value of that form field and use that as the recipient. Take a look at this code:

$mailTemplate->setDesignConfig(array('area' => 'frontend'))
        array('data' => $postObject)

So you need to change the parameter Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT) to a post value (f.e. $post['recipient']).

I hope this will help you out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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