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
-
did you find solution?Mohit Rane– Mohit Rane2021年02月09日 10:59:09 +00:00Commented Feb 9, 2021 at 10:59
1 Answer 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
Explore related questions
See similar questions with these tags.