1

we moved our magento shop to another hosting and now visitors, who use the contact form, get an error message, even though the e-mail is sent successfully.

We didn't change anything in the core files or the template files of the contact form.

The hosting provider told us, that is has to be an error or bug in magento.

I thought about editing the core files, which produce that error, but that would not be a good idea in my opinion, because there is obviously something going wrong.

Did anyone of you run into a similar problem?

Thank you!

Error Message (English):

Unable to submit your request. Please try again later.

Solution:

Thanks to the hint from Fabian Blechschmidt, I found the exact exception:

Unable to send mail. mail(/var/log/mail.php.log): failed to open stream: Permission denied

Even though chmod 777 was set for the log-folder, magento can't create the "mail.php.log"-file on the server. But why?

It turned out that the path "/var/log/" does not mean the path from the magento root, but from the apache root. Therefore, the folder "/var/log" does not exist and can not be created by PHP.

This path is defined by the "mail.log" value in the php.ini. Because I don't need any tracking of mails sent by the server, I just removed this value and everything is working as expected now!

It was no magento-problem, but a wrong server configuration.

Once again, thanks everyone!

  • what error message? – Marius Sep 30 '14 at 7:19
  • Added error message. – webDa Sep 30 '14 at 7:25
  • hi.goto contacts indexcontroller file goto it postAction action and var_dump or print Exception $e for checking where the issue – Amit Bera Sep 30 '14 at 7:40
  • @AmitBera thank you very much! Added the exception... unfortunatly, I can't really get much information out of it... – webDa Sep 30 '14 at 7:51
  • is it print_r($e->message()) given any data? – Amit Bera Sep 30 '14 at 8:00
0

Just dig.

Your Exception is thrown here: app/code/core/Mage/Contacts/controllers/IndexController.php:107

therefore $mailTemplate->getSentSuccess() must be false

It is set false here: app/code/core/Mage/Core/Model/Email/Template.php:479

but the mail is going out, so this code is executed and send() returns false:

app/code/core/Mage/Core/Model/Email/Template.php:506
$this->setSentSuccess($this->send($email, $name, $vars));

this means, this code is executed:

app/code/core/Mage/Core/Model/Email/Template.php:453
    try {
        $mail->send();
        $this->_mail = null;
    }
    catch (Exception $e) {
        $this->_mail = null;
        Mage::logException($e);
        return false;
    }

Most likely Zend_Mail_Transport_Sendmail is used, so it continues here:

\Zend_Mail_Transport_Sendmail::_sendMail

What ever happens there, I would think throw new Zend_Mail_Transport_Exception('Unable to send mail. ' . $this->_errstr); is thrown.

This means for me, you should add some logging here \Zend_Mail_Transport_Sendmail::_handleMailErrors ,because of the catched and newly thrown Exception (app/code/core/Mage/Core/Model/Email/Template.php:453) all the errors descriptions are gone.

But the error should be logged in exception.log. Did you check it? If not, read this: Fundamentals of debugging Magento

  • Thank you for your help! Your hint led me to the right exception and finally to the solution! Read my question for more info about this solution! – webDa Sep 30 '14 at 14:32

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.