private function sendEmail($order, $recoveryCode)
    {

        //Get system general e-mail addresses
        $sender  = [
            'email' => $this->_scopeConfig->getValue('trans_email/ident_general/email', ScopeInterface::SCOPE_STORE),
            'name'  => $this->_scopeConfig->getValue('trans_email/ident_general/name',ScopeInterface::SCOPE_STORE)
        ];

        // Get customer info
        $receiver  = [
            'email' => $order->getCustomerEmail(),
            'name'  => sprintf('%s %s', $order->getCustomerFirstname(), $order->getCustomerLastname())
        ];

        // Send e-mail
        $transport = $this->_transportBuilder->setTemplateIdentifier('abandoned_template')
            ->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 1])
            ->setTemplateVars([
                'order' => $order,
                'pagseguro_recover_url' => $this->abandonedRecoveryUrl($recoveryCode)
            ])
            ->setFrom($sender)
            ->addTo($receiver)
            ->getTransport();

        try {
            $transport->sendMessage();
            return true;
        } catch (\Exception $exception) {
            throw $exception;
        }

    }
private function sendEmail($order, $recoveryCode)
    {

        //Get system general e-mail addresses
        $sender  = [
            'email' => $this->_scopeConfig->getValue('trans_email/ident_general/email', ScopeInterface::SCOPE_STORE),
            'name'  => $this->_scopeConfig->getValue('trans_email/ident_general/name',ScopeInterface::SCOPE_STORE)
        ];

        // Get customer info
        $receiver  = [
            'email' => $order->getCustomerEmail(),
            'name'  => sprintf('%s %s', $order->getCustomerFirstname(), $order->getCustomerLastname())
        ];

        // Send e-mail
        $transport = $this->_transportBuilder->setTemplateIdentifier('abandoned_template')
            ->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 1])
            ->setTemplateVars([
                'order' => $order,
                'pagseguro_recover_url' => $this->abandonedRecoveryUrl($recoveryCode)
            ])
            ->setFrom($sender)
            ->addTo($receiver)
            ->getTransport();

        try {
            $transport->sendMessage();
            return true;
        } catch (\Exception $exception) {
            throw $exception;
        }

    }
private function sendEmail ( $ order , $ recoveryCode ) { //Get system general e-mail addresses $ sender = [ 'email' => $ this -> _scopeConfig -> getValue ( 'trans_email/ident_general/email' , ScopeInterface :: SCOPE_STORE ) , 'name' => $ this -> _scopeConfig -> getValue ( 'trans_email/ident_general/name' , ScopeInterface :: SCOPE_STORE ) ] ; // Get customer info $ receiver = [ 'email' => $ order -> getCustomerEmail ( ) , 'name' => sprintf ( '%s %s' , $ order -> getCustomerFirstname ( ) , $ order -> getCustomerLastname ( ) ) ] ; // Send e-mail $ transport = $ this -> _transportBuilder -> setTemplateIdentifier ( 'abandoned_template' ) -> setTemplateOptions ( [ 'area' => \ Magento \ Framework \ App \ Area :: AREA_FRONTEND , 'store' => 1 ] ) -> setTemplateVars ( [ 'order' => $ order , 'pagseguro_recover_url' => $ this -> abandonedRecoveryUrl ( $ recoveryCode ) ] ) -> setFrom ( $ sender ) -> addTo ( $ receiver ) -> getTransport ( ) ; try { $ transport -> sendMessage ( ) ; return true ; } catch ( \ Exception $ exception ) { throw $ exception ; } }
Send email with abandoned template

@param $order
@param $recoveryCode
@return bool
@throws \Exception
Send email with abandoned template