-1

I have started to get multiple errors after updating to latest Magento 1.9.1:

Fatal error: Call to a member function setMessageBody() on a non-object in /home/tanviherbals/public_html/app/code/core/Mage/Core/Model/Email/Template.php on line 410

I get this error on sending data through contact us form, online consultation form, sending tracking order info, sending emails to customers from backend.

Please help on the same:

www.tanviherbals.com

2 Answers2

1

just change this

if ($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue) {

to

if (false) {

work for order, and register.

tjati
  • 5,761
  • 4
  • 41
  • 56
Falah
  • 191
  • 3
  • 9
0

go to 410 line and put this

if(Mage::app()->getRequest()->getControllerName()=='index')
            {
                               if (($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue)) {
                                    /** @var $emailQueue Mage_Core_Model_Email_Queue */
                                    $emailQueue = $this->getQueue();
                                    $emailQueue->setMessageBody($text);
                                    $emailQueue->setMessageParameters(array(
                                            'subject'           => $subject,
                                            'return_path_email' => $returnPathEmail,
                                            'is_plain'          => $this->isPlain(),
                                            'from_email'        => $this->getSenderEmail(),
                                            'from_name'         => $this->getSenderName(),
                                            'reply_to'          => $this->getMail()->getReplyTo(),
                                            'return_to'         => $this->getMail()->getReturnPath(),
                                        ))
                                        ->addRecipients($emails, $names, Mage_Core_Model_Email_Queue::EMAIL_TYPE_TO)
                                        ->addRecipients($this->_bccEmails, array(), Mage_Core_Model_Email_Queue::EMAIL_TYPE_BCC);
                                    $emailQueue->addMessageToQueue();

                                    return true;
                                }
                    }
                    else
                    {
                                           if (!($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue)) {
                                    /** @var $emailQueue Mage_Core_Model_Email_Queue */
                                    $emailQueue = $this->getQueue();
                                    $emailQueue->setMessageBody($text);
                                    $emailQueue->setMessageParameters(array(
                                            'subject'           => $subject,
                                            'return_path_email' => $returnPathEmail,
                                            'is_plain'          => $this->isPlain(),
                                            'from_email'        => $this->getSenderEmail(),
                                            'from_name'         => $this->getSenderName(),
                                            'reply_to'          => $this->getMail()->getReplyTo(),
                                            'return_to'         => $this->getMail()->getReturnPath(),
                                        ))
                                        ->addRecipients($emails, $names, Mage_Core_Model_Email_Queue::EMAIL_TYPE_TO)
                                        ->addRecipients($this->_bccEmails, array(), Mage_Core_Model_Email_Queue::EMAIL_TYPE_BCC);
                                    $emailQueue->addMessageToQueue();

                                    return true;
                                }

                    }
benka
  • 4,732
  • 35
  • 47
  • 58