I was trying to send by email following to this blog, where they inject transportBuilder object .
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
\Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\Escaper $escaper
) {
parent::__construct($context);
$this->_transportBuilder = $transportBuilder;
$this->inlineTranslation = $inlineTranslation;
$this->scopeConfig = $scopeConfig;
$this->storeManager = $storeManager;
$this->_escaper = $escaper;
}
but when i try to do the same it says:
Exception #0 (Exception): Recoverable Error: Argument 2 passed to Company\Module\Controller\Index\Index::__construct() must be an instance of Magento\Framework\Mail\Template\TransportBuilder, instance of Magento\Framework\View\Result\PageFactory given
Not sure where im doing wrong .