title: Understading stack trace from error log? (Magento)
body: <p>I've been looking for guides on how to read and understand a stack trace. 
  In this case, people are getting errors when trying to fill out and send an contact form. And I'am really having trouble fixing this, and it's not any easier when I cannot decipher the stack. (This is a magento 1.6.2 installation)</p>
  
  <p>The email are being sent, but the contact form tells the user that there was a problem, so we get alot of duplicates from people trying again, and again.</p>
  
  <pre><code>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-&gt;_sendMail()
  #1 /var/www/site.dk/public_html/lib/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract-&gt;send(Object(Zend_Mail))
  #2 /var/www/site.dk/public_html/app/code/core/Mage/Core/Model/Email/Template.php(409): Zend_Mail-&gt;send()
  #3 /var/www/site.dk/public_html/app/code/core/Mage/Core/Model/Email/Template.php(462): Mage_Core_Model_Email_Template-&gt;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-&gt;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-&gt;postAction()
  #6 /var/www/site.dk/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action-&gt;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-&gt;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-&gt;dispatch()
  #9 /var/www/site.dk/public_html/app/Mage.php(640): Mage_Core_Model_App-&gt;run(Array)
  #10 /var/www/site.dk/public_html/shop/index.php(80): Mage::run('store...', 'store')
  #11 {main}
  </code></pre>
  
  <p>The snippet from sendmail.php</p>
  
  <pre><code>public function _sendMail()
  {
      if ($this-&gt;parameters === null) {
          set_error_handler(array($this, '_handleMailErrors'));
          $result = mail(
              $this-&gt;recipients,
              $this-&gt;_mail-&gt;getSubject(),
              $this-&gt;body,
              $this-&gt;header);
          restore_error_handler();
      } else {
          if(!is_string($this-&gt;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-&gt;recipients,
              $this-&gt;_mail-&gt;getSubject(),
              $this-&gt;body,
              $this-&gt;header,
              $this-&gt;parameters);
          restore_error_handler();
      }
  
      if ($this-&gt;_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-&gt;_errstr);
      }
  }
  </code></pre>