2

Hi I upgrade my magento 2.2.3 to 2.2.8 where I have some custom functionality for emails.

After upgrading am getting

Fatal error: Uncaught Error: Call to undefined method Magento\Framework\Mail\Message\Interceptor::clearFrom() 
Fatal error: Uncaught Error: Call to undefined method Magento\Framework\Mail\Message\Interceptor::getRawContent() 

I have made plugin for public function \Magento\Email\Model\Transport

 beforeSendMessage(\Magento\Email\Model\Transport $subject)
 { 
 $message = $subject->getMessage()
 $body = $message->getBody()->getRawContent();
 $message->clearFrom();
 $message->setBody($bodyNew);
 }

its \Magento\Framework\Mail\Message

asked Apr 12, 2019 at 20:05
1
  • did you find solution? Commented Feb 9, 2021 at 10:59

1 Answer 1

1

buddy I just check that class I'm also gonna share as well that class
Magento\Framework\Mail\Message;

<?php
/**
 * Mail Message
 *
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Framework\Mail;
class Message extends \Zend_Mail implements MessageInterface
{
 /**
 * @param string $charset
 */
 public function __construct($charset = 'utf-8')
 {
 parent::__construct($charset);
 $this->setHeaderEncoding(\Zend_Mime::ENCODING_BASE64);
 }
 /**
 * Message type
 *
 * @var string
 */
 protected $messageType = self::TYPE_TEXT;
 /**
 * Set message body
 *
 * @param string $body
 * @return $this
 */
 public function setBody($body)
 {
 return $this->messageType == self::TYPE_TEXT ? $this->setBodyText($body) : $this->setBodyHtml($body);
 }
 /**
 * Set message body
 *
 * @return string
 */
 public function getBody()
 {
 return $this->messageType == self::TYPE_TEXT ? $this->getBodyText() : $this->getBodyHtml();
 }
 /**
 * Set message type
 *
 * @param string $type
 * @return $this
 */
 public function setMessageType($type)
 {
 $this->messageType = $type;
 return $this;
 }
}

so as you can see that there is no any function getRawContent() or clearFrom() so they may updated that as well in the updated version thats why its not working

answered Apr 12, 2019 at 20:41
2
  • this is really bad :( Commented Apr 12, 2019 at 20:44
  • you fixed?this isssue Commented Nov 21, 2019 at 8:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.