简体   繁体   中英

magento contact form unable to submit your request

I am currently in the process of doing a project in magento.
I have a problem with my contact form: emails are not sent to me.
I did a test and I still get this message:

Unable to submit your request . Please, try again later

It's probably because an exception is thrown as you can see in the file app/code/core/Mage/Contacts/controllers/IndexController.php in the postAction() function, you should try to debug from here.

Maybe the contact email failled to be sent (if you are in localhost and have no mail server?), that could cause the exception that shows this error.

I've been struggling with this for a day as nobody gives a clear answer on the topic.

In order to get it working there are 2 options:

  1. Configure smtp server for email sending using smtp pro extension from Magento connect
  2. Make Magento use the SendMail function of the webserver

As the first option didn't work for me, as my hosting provider somehow block the smtp outgoing connection, I needed to use the SendMail function.

The quick and dirty trick I used, was to change /app/code/core/Mage/Core/Model/Email/Template.php line 116:

Zend_Mail::setDefaultTransport($transport);  → //Zend_Mail::setDefaultTransport($transport);

After this my error message at the contact form was gone and I received the email correctly.

Be carefull: This is not a good solution as it will be undone at a Magento update. Also it was not tested for the other email functions of Magento.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM