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:
- 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!
- 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/”
- Check if you maybe missed configuration settings for enabling email sending functionalities.
- 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.
- Create new transaction email for Contact form transactional email and name it differently than default.
Hope this helps someone!
17 comments
Hello Airton, why don’t try out a contact form from ContactUs.com? I tried out and I liked it.
Thank you for the post.
Step 5 solved the problem for us.
Also doesn’t work on Enterprise Magento vers. 1.12.0.2
Hello,
I experience the same situation as described by Ryan.
This fix doesn’t work on Entreprise 1.9
Any suggestion?
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
@magento tutorial
Yes you can!
i want to know if the url key is the controller of the page,can i use another url key
@sjolzy
Nice to hear that!
Vanja, you saved my time
Nice one Vanja!
@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.
@Ana
You were right. There was a typo, but corrected really fast. Thank you for input ๐
public function setReplyTo($email)
{
$this->getMail()->setReplyTo($email);
return $this;
}
—
Surely thats an infinite loop???
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!
Hey Vanja, thanks for this good information. Keep up the good work.
Ana, headline is the same as you wrote ๐ . I do not know what you mean?
Vanja, I hoticed one small mistake in your headline. I suppose that you wanted to write: “Problems with Contact form”. ๐