Problems with Contact form

Problems with Contact form

Couple of days ago I had a problem with contact form not working in Magento Professional 1.9.0.0. Magento was throwing error “Unable to submit your request. Please, try again later” after submitting form. Of course all requested fields was filled. Here I will explain what needs to be done if you have same problems.

First thing, which would probably solve the problem, was to change following function of app/code/core/Mage/Core/Model/Email/Template.php

  public function setReplyTo($email)
    {
        $this->getMail()->addHeader('Reply-To', $email);
        return $this;
    }

to

public function setReplyTo($email)
    {
        $this->getMail()->setReplyTo($email);
        return $this;
    }

You can override this function in a dirty way by creating same folder hierarchy to Template.php file in your app/code/local or creating separate module (Magento way which will avoid possible overwriting when upgrading to newer version of Magento)

Additional problem solving steps are:

  1. Create new CMS page and call form.phtml from there. You can do this by following:
    • Create new CMS page
    • URL key value: contacts
    • Content value:
      < !– CONTACT FORM –>
      {{block type=’core/template’ name=’contactForm’ template=’contacts/form.phtml’}}
      < !– END OF CONTACT FORM –>
      P.S. Watch to have single quotes!
  2. Check if form action attribute is set right. Sometimes this can generate a problem. Action attribute value should point to: http://yourdomain.com/contacts/index/post/. Originally value for action attribute is
    <?php echo $this->getFormAction(); ?>

    but you can try it to set it manually to “http://yourdomain.com/contacts/index/post/”

  3. Check if you maybe missed configuration settings for enabling email sending functionalities.
  4. Try to change “Sending emails to” to some other email which do not have same email domain as your Magento website. Some hosts can produce problem if “Sending from” email is from same host provider as the “Sending to” email.
  5. Create new transaction email for Contact form transactional email and name it differently than default.

Hope this helps someone!

You made it all the way down here so you must have enjoyed this post! You may also like:

How to connect Google Analytics 4 to Magento 2 Bojan Mareljic
Bojan Mareljic, | 35

How to connect Google Analytics 4 to Magento 2

3 best open-source eCommerce platforms in 2021 Zrinka Antolovic
Zrinka Antolovic, | 7

3 best open-source eCommerce platforms in 2021

Contact Form in Magento Domagoj Potkoc
Domagoj Potkoc, | 114

Contact Form in Magento

17 comments

  1. Hello,
    I experience the same situation as described by Ryan.

    This fix doesn’t work on Entreprise 1.9

    Any suggestion?

  2. Hello,

    I saw this fix on another site that pointed out it might break all other emails. This is the case for us, as this did not resolve the stated issue with contact_us and made it so that no other emails came out either.

    Any other options? There are so many threads on this error, and I have tried them all.

    I’m on Enterprise Magento ver. 1.9.0.0

  3. @Kevin $this->getMail() returns Zend_Mail object. Method “setReplyTo($email)” is not called on Mage_Core_Model_Email_Template, therefore that’s not an infinite loop.

  4. public function setReplyTo($email)
    {
    $this->getMail()->setReplyTo($email);
    return $this;
    }

    Surely thats an infinite loop???

  5. It was originally written : “Problems with Contact from”, instead of: “Problems with Contact form”. I noticed that so I wrote, and few hours later, somebody changed that. 🙂 Maybe because of my comment or somebody else also noticed that. 😉

    Cheers!

  6. Vanja, I hoticed one small mistake in your headline. I suppose that you wanted to write: “Problems with Contact form”. 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.