0

I am using Magento's contact us form, which, at the moment, doesn't send a copy of the contact us form to the customer who is filling the form in.

I want to control this with a checkbox, therefore i have added a checkbox to the form.phtml page:

<input type="checkbox" name="sendcopy" value="Yes" checked/>

How can i configure the send e-mail function so that it sends out a copy (to the e-mail address which is filled in, in the e-mail field of the contact form) of the e-mail when the checkbox is checked, and doesn't send a copy when it is not checked?

0

You can do this by using bcc function addBcc($post['email]) after -setReplyTo($post['email']) at class Mage_Contacts_IndexController of function postAction().

$mailTemplate = Mage::getModel('core/email_template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
    ->setReplyTo($post['email'])
    <!-- add this -->
    ->addBcc($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)
                    );
| improve this answer | |
  • Thanks, i understand this part will send the e-mail as BCC to the sender. How can i build in the check, that this function will only be active when the checkbox is checked? – John Mar 29 '15 at 14:59
  • yes. this can do this bcc – Amit Bera Mar 29 '15 at 15:00
  • I have added the line, but no e-mail is being sent unfortunately. – John Mar 29 '15 at 18:42
0

I would not recommend this. What's to stop a bot filling out spam content, someone else's email, ticking the box and turning your magento store into a spam server.

If you do decide to do this make sure you have captcha on the form.

| improve this answer | |

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.