Tag Archives: Magento 2 Beginer Tutorial
Magento 2 Send email programmatically
Magento 2 Send email programmatically transactional emails– Sending emails is the important functionality of any framework, Magento2 has its own to handle the mail functionality. Here in this post we are going to explain how you can send transactional emails programmatically with or without template from your custom module.
Magento 2 Send email programmatically | Transactional Emails Example
You can use the following steps to send emails easily-
- 1. Create Template
- 2. Create Config
- 3. Create Function
1. Create Template
Now create template with some sample text located at the below specified path.
/app/code/VendorName/ModuleName/view/frontend/email/modulename/myTemplate.html
Magento 2 Send email programmatically Template:
|
2. Create Config
Now create configuration file to declare template-
/app/code/VendorName/ModuleName/etc/email_templates.xml
Magento 2 Send email configuration Example:
|