free
web stats

Fill the form & Get Installation Support

We don't monkey around your business.

GET IN TOUCH WITH US NOW





captcha

Magento 2 Add file Attachment in email using custom module

If you want to implement “add file attachment in the email” functionality in Magento 2, then please follow the below step.

Step 1) Create Vendor/Module/etc/di.xml

Step 2) Please create the email template in Vendor/Module/view/frontend/email/email_template.html
then after calling this file to Vendor/Module/etc/email_templates.xml

Step 3) CreateTransportBuilder and extend with \Magento\Framework\Mail\Template\TransportBuilder

Create Vendor/Module/Model/Mail/TransportBuilder.php

Step 4) Send mail using controller in execute method
Create Vendor/Module/Controller/Index/Index.php