0

I am getting this error: The input is not a valid email address. Use the basic format local-part@hostname

The error is in this custom module file and Magento version is 2.2.8:

<?php
namespace Test\SecondModule\Helper;

use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Address\Renderer;

class EmailSeller extends \Magento\Framework\App\Helper\AbstractHelper
{
const XML_PATH_TRANS_EMAIL_GENERAL_EMAIL = 'trans_email/ident_general/email';
const XML_PATH_TRANS_EMAIL_GENERAL_NAME = 'trans_email/ident_general/name';

/**
 * Store manager
 *
 * @var \Magento\Store\Model\StoreManagerInterface
 */
protected $_storeManager;

/**
 * @var \Magento\Newsletter\Model\SubscriberFactory
 */
protected $_subscriberFactory;

/**
 * @var \Magento\Framework\ObjectManagerInterface
 */
protected $_objectManager;

/**
 * @var \Magento\GiftMessage\Model\MessageFactory
 */
protected $_giftMessageFactory;

/**
 * @var \Magento\Framework\Mail\Template\TransportBuilder
 */
protected $_transportBuilder;

/**
 * @var Renderer
 */
protected $_addressRenderer;

/**
 * @var \Magento\Payment\Helper\Data
 */
protected $_paymentHelperData;

/**
 * @var \Magento\Framework\Translate\Inline\StateInterface
 */
protected $inlineTranslation;

/**
 * @var \Magento\Checkout\Model\Session
 */
protected $_checkoutSession;

/**
 * @var \Magento\Framework\Pricing\PriceCurrencyInterface
 */
protected $_priceCurrency;

/**
 * Data constructor.
 *
 * @param \Magento\Framework\App\Helper\Context              $context
 * @param \Magento\Store\Model\StoreManagerInterface         $storeManager
 * @param \Magento\Framework\Mail\Template\TransportBuilder  $transportBuilder
 * @param Renderer                                           $addressRenderer
 * @param \Magento\Payment\Helper\Data                       $paymentHelperData
 * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
 * @param \Magento\Framework\ObjectManagerInterface          $objectManager
 * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
 * @param \Magento\GiftMessage\Model\MessageFactory          $giftMessageFactory
 * @param \Magento\Checkout\Model\Session                    $checkoutSession
 * @param \Magento\Framework\Pricing\PriceCurrencyInterface  $priceCurrency
 * @param \Magento\Newsletter\Model\SubscriberFactory        $subscriberFactory
 */
 protected $_escaper;
public function __construct(
    \Magento\Framework\Escaper $_escaper,
    \Magento\Framework\App\Helper\Context $context,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
    Renderer $addressRenderer,
    \Magento\Payment\Helper\Data $paymentHelperData,
    \Magento\Framework\ObjectManagerInterface $objectManager,
    \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
    \Magento\GiftMessage\Model\MessageFactory $giftMessageFactory,
    \Magento\Checkout\Model\Session $checkoutSession,
    \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency,
    \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory
)
{
    parent::__construct($context);
    $this->_storeManager = $storeManager;
    $this->_subscriberFactory = $subscriberFactory;
    $this->_transportBuilder = $transportBuilder;
    $this->_paymentHelperData = $paymentHelperData;
    $this->_addressRenderer = $addressRenderer;
    $this->_objectManager = $objectManager;
    $this->_giftMessageFactory = $giftMessageFactory;
    $this->inlineTranslation = $inlineTranslation;
    $this->_checkoutSession = $checkoutSession;
    $this->_priceCurrency = $priceCurrency;
     $this->_escaper=$_escaper;
}

/**
 * @param $email
 */
public function addSubscriber($email)
{
    if ($email) {
        $subscriberModel = $this->_subscriberFactory->create()->loadByEmail($email);
        if ($subscriberModel->getId() === NULL) {
            try {
                $this->_subscriberFactory->create()->subscribe($email);
            } catch (\Magento\Framework\Exception\LocalizedException $e) {

            } catch (\Exception $e) {

            }
        } elseif ($subscriberModel->getData('subscriber_status') != 1) {
            $subscriberModel->setData('subscriber_status', 1);
            try {
                $subscriberModel->save();
            } catch (\Exception $e) {

            }
        }
    }
}

/**
 * Get payment info block as html
 *
 * @param Order $order
 *
 * @return string
 */
protected function getPaymentHtml(Order $order, $storeId)
{
    return $this->_paymentHelperData->getInfoBlockHtml(
        $order->getPayment(),
        $storeId
    );
}

/**
 * @return \Magento\Checkout\Model\Type\Onepage
 */
public function getOnePage()
{
    return $this->_objectManager->get('Magento\Checkout\Model\Type\Onepage');
}

/**
 * @param Order $order
 *
 * @return string|null
 */
protected function getFormattedShippingAddress($order)
{
    return $order->getIsVirtual()
        ? NULL
        : $this->_addressRenderer->format($order->getShippingAddress(), 'html');
}

/**
 * @param Order $order
 *
 * @return string|null
 */
protected function getFormattedBillingAddress($order)
{
    return $this->_addressRenderer->format($order->getBillingAddress(), 'html');
}

/**
 * @param \Magento\Sales\Model\Order $order
 */
public function sendNewOrderEmail(\Magento\Sales\Model\Order $order,$sellerId)
{
    $storeId = $order->getStore()->getId();
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($sellerId);
    $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
    $connection = $resource->getConnection();
    $tableName = $resource->getTableName('multivendor_saleslist'); 
    $sql = "Select * FROM " . $tableName." where sellerid=".$sellerId."";
    $result = $connection->fetchAll($sql); 
    $this->inlineTranslation->suspend();
     if(count($result) == 0){

        try {
            $transport = $this->_transportBuilder->setTemplateIdentifier(
                'SecondModule_general_email_seller_first_order'
            )->setTemplateOptions(
                ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
            )->setTemplateVars(
                [
                    'myvar1' => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname')),
                ]
            )->setFrom(
                [
                    'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                    'name'  => 'Admin Notification'
                ]
            )->addTo(
                [
                    'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                    'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
                ]
            )->getTransport();
            $transport->sendMessage();
        } catch (\Magento\Framework\Exception\MailException $ex) {

        }

    }
    try {
        $transport = $this->_transportBuilder->setTemplateIdentifier(
            'SecondModule_general_email_order_vendor'
        )->setTemplateOptions(
            ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
        )->setTemplateVars(
            [
                'seller_id'                => $sellerId,
                'seller_name'              => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname')),
                'order'                    => $order,
                'billing'                  => $order->getBillingAddress(),
                'payment_html'             => $this->getPaymentHtml($order, $storeId),
                'store'                    => $order->getStore(),
                'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
                'formattedBillingAddress'  => $this->getFormattedBillingAddress($order),
            ]
        )->setFrom(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin Notification',
            ]
        )->addTo(
            [
                'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->getTransport();
        $transport->sendMessage();
    } catch (\Magento\Framework\Exception\MailException $ex) {

    }
    $this->inlineTranslation->resume();
}

/**
 * @param \Magento\Customer\Model\Customer $customer
 */
public function sendRegisterSellerEmail($customer)
{
    $storeId = $this->_storeManager->getStore()->getId();
    $this->inlineTranslation->suspend();
    try {
        $transport = $this->_transportBuilder->setTemplateIdentifier(
            'SecondModule_general_email_register_vendor'
        )->setTemplateOptions(
            ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
        )->setTemplateVars(
            [
                'myvar1' => 'Admin',
                'myvar2' => \Magento\Framework\App\ObjectManager::getInstance()->create('Magento\Backend\Helper\Data')->getUrl('customer/index/edit', array('id'=>$customer[0]['entity_id']))
            ]
        )->setFrom(
            [
                'email' => $this->_escaper->escapeHtml($customer[0]['email']),
                'name'  => $this->_escaper->escapeHtml($customer[0]['firstname']).$this->_escaper->escapeHtml($customer[0]['lastname'])
            ]
        )->addTo(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin'
            ]
        )->getTransport();
        $transport->sendMessage();
    } catch (\Magento\Framework\Exception\MailException $ex) {

    }
    $this->inlineTranslation->resume();
}

/**
 * @param id customer
 */
public function sendApproveSellerEmail($customer_id)
{
    $storeId = $this->_storeManager->getStore()->getId();
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($customer_id);
    $this->inlineTranslation->suspend();
    try {
        $transport = $this->_transportBuilder->setTemplateIdentifier(
            'SecondModule_general_email_approve_vendor'
        )->setTemplateOptions(
            ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
        )->setTemplateVars(
            [
                'myvar1' => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname')),
                'myvar2' => $this->_storeManager->getStore()->getUrl('customer/account/login')
            ]
        )->setFrom(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin Notification'
            ]
        )->addTo(
            [
                'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->getTransport();
        $transport->sendMessage();
    } catch (\Magento\Framework\Exception\MailException $ex) {

    }
    $this->inlineTranslation->resume();
}
 public function sendProductUploadSuccessEmailToSeller($customer_id)
{
    $storeId = $this->_storeManager->getStore()->getId();
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($customer_id);
    $this->inlineTranslation->suspend();
    try {
        $transport = $this->_transportBuilder->setTemplateIdentifier(
            'SecondModule_general_email_product_upload_success'
        )->setTemplateOptions(
            ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
        )->setTemplateVars(
            [

                'myvar1' => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname')),
            ]
        )->setFrom(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin Notification'
            ]
        )->addTo(
            [
                'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->getTransport();
        $transport->sendMessage();
    } catch (\Magento\Framework\Exception\MailException $ex) {

    }
    $this->inlineTranslation->resume();
}
/**
 * @param id customer
 */
public function sendUnapproveSellerEmail($customer_id)
{
    $storeId = $this->_storeManager->getStore()->getId();
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($customer_id);
    $this->inlineTranslation->suspend();
    try {
        $transport = $this->_transportBuilder->setTemplateIdentifier(
            'SecondModule_general_email_unapprove_vendor'
        )->setTemplateOptions(
            ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
        )->setTemplateVars(
            [
                'myvar1' => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname')),
                'myvar2' => $this->_storeManager->getStore()->getUrl('customer/account/login')
            ]
        )->setFrom(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin Notification'
            ]
        )->addTo(
            [
                'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->getTransport();
        $transport->sendMessage();
    } catch (\Magento\Framework\Exception\MailException $ex) {

    }
    $this->inlineTranslation->resume();
}

public function sendRequestWithdrawEmailToSeller($data)
{
    $storeId = $this->_storeManager->getStore()->getId();
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($data['seller_id']);
    //data 
    $paymentDetail = $objectManager->create('Test\SecondModule\Model\Payments')->load($data['payment_id']);                
    $this->inlineTranslation->suspend();
    try {
        $transport = $this->_transportBuilder->setTemplateIdentifier(
            'SecondModule_general_email_withdraw_vendor'
        )->setTemplateOptions(
            ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
        )->setTemplateVars(
            [
                'payment' => $paymentDetail,    
                'payment_email' => $data['payment_email'],   
                'amount' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['transaction_amount'],true,false),    
                'fee' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['amount_fee'],true,false),          
                'net' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['amount_paid'],true,false),  
                'info' => $data['payment_additional'],          
                'myvar1' => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->setFrom(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin Notification'
            ]
        )->addTo(
            [
                'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->getTransport();
        $transport->sendMessage();
    } catch (\Magento\Framework\Exception\MailException $ex) {

    }
    $this->inlineTranslation->resume();
}

public function sendRequestWithdrawEmailToAdmin($data)
{
    $storeId = $this->_storeManager->getStore()->getId();
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($data['seller_id']);
    //data 
    $paymentDetail = $objectManager->create('Test\SecondModule\Model\Payments')->load($data['payment_id']);                
    $this->inlineTranslation->suspend();
    try {
        $transport = $this->_transportBuilder->setTemplateIdentifier(
            'SecondModule_general_email_withdraw_admin'
        )->setTemplateOptions(
            ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
        )->setTemplateVars(
            [
                'seller_name' => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname')),
                'payment' => $paymentDetail,    
                'payment_email' => $data['payment_email'],   
                'amount' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['transaction_amount'],true,false),    
                'fee' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['amount_fee'],true,false),          
                'net' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['amount_paid'],true,false),   
                'info' => $data['payment_additional'],          
                'myvar1' => 'Admin'
            ]
        )->setFrom(
            [
                'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->addTo(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin'
            ]
        )->getTransport();
        $transport->sendMessage();
    } catch (\Magento\Framework\Exception\MailException $ex) {

    }
    $this->inlineTranslation->resume();
}

public function sendCompleteWithdrawEmailToSeller($data)
{
    $storeId = $this->_storeManager->getStore()->getId();
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($data['seller_id']);
    //data 
    $paymentDetail = $objectManager->create('Test\SecondModule\Model\Payments')->load($data['payment_id']);                
    $this->inlineTranslation->suspend();
    try {
        $transport = $this->_transportBuilder->setTemplateIdentifier(
            'SecondModule_general_email_complete_withdraw_vendor'
        )->setTemplateOptions(
            ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
        )->setTemplateVars(
            [
                'payment' => $paymentDetail,    
                'payment_email' => $data['payment_email'],   
                'amount' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['transaction_amount'],true,false),    
                'fee' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['amount_fee'],true,false),          
                'net' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['amount_paid'],true,false),  
                'info' => $data['payment_additional'], 
                'admin_comnent' => $data['note'],     
                'status' => $data['status'],       
                'myvar1' => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->setFrom(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin Notification'
            ]
        )->addTo(
            [
                'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->getTransport();
        $transport->sendMessage();
    } catch (\Magento\Framework\Exception\MailException $ex) {

    }
    $this->inlineTranslation->resume();
}

public function sendCompelteWithdrawEmailToAdmin($data)
{
    $storeId = $this->_storeManager->getStore()->getId();
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($data['seller_id']);
    //data 
    $paymentDetail = $objectManager->create('Test\SecondModule\Model\Payments')->load($data['payment_id']);                
    $this->inlineTranslation->suspend();
    try {
        $transport = $this->_transportBuilder->setTemplateIdentifier(
            'SecondModule_general_email_complete_withdraw_admin'
        )->setTemplateOptions(
            ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
        )->setTemplateVars(
            [
                'seller_name' => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname')),
                'payment' => $paymentDetail,    
                'payment_email' => $data['payment_email'],   
                'amount' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['transaction_amount'],true,false),    
                'fee' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['amount_fee'],true,false),          
                'net' => \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Pricing\Helper\Data')->currency($data['amount_paid'],true,false),   
                'info' => $data['payment_additional'],   
                'admin_comnent' => $data['note'],   
                'status' => $data['status'],        
                'myvar1' => 'Admin'
            ]
        )->setFrom(
            [
                'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->addTo(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SecondModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin'
            ]
        )->getTransport();
        $transport->sendMessage();
    } catch (\Magento\Framework\Exception\MailException $ex) {

    }
    $this->inlineTranslation->resume();
}

/**
 * @return \Magento\Quote\Model\Quote
 */
public function getQuote()
{
    if (empty($this->_quote)) {
        $this->_quote = $this->_checkoutSession->getQuote();
    }

    return $this->_quote;
}
}

Contents of data file regarding mail, i cant add he whole file stackexchange doesnt allow me too many characters:

const XML_PATH_ADMIN_EMAIL     = 'secondmodule/general/admin_email';
const XML_PATH_EMAIL_CONTACT_VENDOR   = 'secondmodule/general/email_contact_vendor';
public function getAdminEmail($store = null)
{
    return $this->scopeConfig->getValue(
        self::XML_PATH_ADMIN_EMAIL,
        ScopeInterface::SCOPE_STORE
    );
public function getEmailTemplateContactVendor()
{
    return $this->scopeConfig->getValue(
        self::XML_PATH_EMAIL_CONTACT_VENDOR,
        ScopeInterface::SCOPE_STORE
    );
}
}
public function getSellerById($id){     
    $sellerCollection=$this->_objectmanager->create('Test\secondmodule\Model\ResourceModel\Sellers\Collection')->addFieldToFilter('user_id',$id);
    return $sellerCollection->getData();
}

Above you can see the updated file with escape included as adviced but still getting the same error. Hope anyone can help.

  • Can you please paste the code for Test\SeconModule\Helper\Data file? Thanks – Shankar Jun 2 at 15:45
  • Please check the code related to mail found in data file. – mahdi danash Jun 4 at 0:35
0

You need to use escape html function like below

->setFrom(
            [
                'email' => $this->_escaper->escapeHtml($customer->getData('email')),
                'name'  => $this->_escaper->escapeHtml($customer->getData('firstname')) . ' ' . $this->_escaper->escapeHtml($customer->getData('lastname'))
            ]
        )->addTo(
            [
                'email' => \Magento\Framework\App\ObjectManager::getInstance()->create('Test\SeconModule\Helper\Data')->getAdminEmail(),
                'name'  => 'Admin'
            ]
        )

Please check add $this->_escaper->escapeHtml() to all the email and name and it will fix your problem. Please let me know if you still facing this issue. Thanks.

  • I did as adviced, the the new code above. but still getting the same error. – mahdi danash Jun 4 at 14:32
  • Hi, Magento 2.2.8 is using the new zend framework similar to version 2.3. so the code is not compatible. can anyone show me how to make my code compatible with the new zend framework – mahdi danash Jun 7 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.