How to send image attachment with email template in magento 2

For Attach image in email template, you need to override TransportBuilder Class from Magento\Framework\Mail\Template\TransportBuilder

For Override TransportBuilder.php file in Magento 2, you need to create di.xml file.
Using di.xml file you can override any php class in Magento 2.

Create di.xml in your module,
app/code/Rbj/ImageAttachement/etc/di.xml

Create TransportBuilder.php file at below location,

app/code/Rbj/ImageAttachement/Model/Mail/Template/TransportBuilder.php

Create helper file to send image attachment in mail template,

 

Leave a Reply

Your email address will not be published. Required fields are marked *