我一直在寻找有关如何阅读和理解堆栈跟踪的指南。在这种情况下,人们在尝试填写和发送联系表时会遇到错误。而且我真的很难解决这个问题,当我无法破译堆栈时,这并不容易。(这是一个magento 1.6.2 安装)
电子邮件正在发送,但联系表格告诉用户存在问题,因此我们从人们一次又一次地尝试中得到很多重复。
exception 'Zend_Mail_Transport_Exception' with message 'Unable to send mail. mail(/var/www/site.dk/logs/php-maillog.log): failed to open stream: Permission denied' in /var/www/site.dk/public_html/lib/Zend/Mail/Transport/Sendmail.php:137
Stack trace:
#0 /var/www/site.dk/public_html/lib/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Sendmail->_sendMail()
#1 /var/www/site.dk/public_html/lib/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#2 /var/www/site.dk/public_html/app/code/core/Mage/Core/Model/Email/Template.php(409): Zend_Mail->send()
#3 /var/www/site.dk/public_html/app/code/core/Mage/Core/Model/Email/Template.php(462): Mage_Core_Model_Email_Template->send('email@email.com', NULL, Array)
#4 /var/www/site.dk/public_html/app/code/core/Mage/Contacts/controllers/IndexController.php(104): Mage_Core_Model_Email_Template->sendTransactional('1', 'general', 'email@email.com', NULL, Array)
#5 /var/www/site.dk/public_html/app/code/local/Mage/Core/Controller/Varien/Action.php(420): Mage_Contacts_IndexController->postAction()
#6 /var/www/site.dk/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('post')
#7 /var/www/site.dk/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#8 /var/www/site.dk/public_html/app/code/local/Mage/Core/Model/App.php(348): Mage_Core_Controller_Varien_Front->dispatch()
#9 /var/www/site.dk/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#10 /var/www/site.dk/public_html/shop/index.php(80): Mage::run('store...', 'store')
#11 {main}
sendmail.php 中的片段
public function _sendMail()
{
if ($this->parameters === null) {
set_error_handler(array($this, '_handleMailErrors'));
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header);
restore_error_handler();
} else {
if(!is_string($this->parameters)) {
/**
* @see Zend_Mail_Transport_Exception
*
* Exception is thrown here because
* $parameters is a public property
*/
#require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception(
'Parameters were set but are not a string'
);
}
set_error_handler(array($this, '_handleMailErrors'));
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header,
$this->parameters);
restore_error_handler();
}
if ($this->_errstr !== null || !$result) {
/**
* @see Zend_Mail_Transport_Exception
*/
#require_once 'Zend/Mail/Transport/Exception.php';
(137) throw new Zend_Mail_Transport_Exception('Unable to send mail. ' . $this->_errstr);
}
}