• Home
  • About Us
  • Contact Us
  • DMCA
  • Sitemap
  • Privacy Policy
Monday, May 29, 2023
Insta Citizen
No Result
View All Result
  • Home
  • Technology
  • Computers
  • Gadgets
  • Software
  • Solar Energy
  • Artificial Intelligence
  • Home
  • Technology
  • Computers
  • Gadgets
  • Software
  • Solar Energy
  • Artificial Intelligence
No Result
View All Result
Insta Citizen
No Result
View All Result
Home Software

set dynamic e-mail topic and content material in Magento 2

Insta Citizen by Insta Citizen
May 12, 2023
in Software
0
set dynamic e-mail topic and content material in Magento 2
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter


Typically we have to present buyer title, order id, OTP and so on in e-mail topic or physique.

Step 1 -> Register template in e-mail. Webkul/Howdy/and so on/email_templates.xml

<?xml model="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:and so on/email_templates.xsd">
    <template id="hello_template" label="Howdy World" file="hey.html" kind="html" module="Webkul_Hello" space="frontend"/>
</config>

Step 2 -> Load e-mail content material in Webkul/Howdy/view/frontend/e-mail/hey.html

<[email protected] {{trans "Buyer has uploaded attachment on %order_id" order_id=$orderId }} @-->
<[email protected]
physique,td { coloration:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
@-->
{{template config_path="design/e-mail/header_template"}}
<desk cellspacing="0" cellpadding="0" border="0" width="100%">
    <tr>
        <td align="middle" valign="prime" fashion="padding:20px 0 20px 0">
            <desk bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" fashion="border:1px stable #E0E0E0;">
                <tr>
                    <td valign="prime">
                        <h1 fashion="font-size:22px;font-weight:regular;line-height:22px;margin:0 0 11px 0;">{{trans "Howdy"}},</h1>
                    </td>
                </tr>
                <tr>
                    <td>
                        <desk cellspacing="0" cellpadding="0" border="0" width="650">
                            <tbody>
                                <tr>
                                    <td colspan="2" valign="prime" fashion="font-size:24px;padding:7px 9px 9px 9px;border:1px stable #EAEAEA;">
                                            <b>{{trans "Order Id: "}}{{var orderId}}</b>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" valign="prime" fashion="font-size:12px;padding:7px 9px 9px 9px;border:1px stable #EAEAEA;">
                                        {{trans "A Buyer %customer_name has uploaded attachment so as %order_id" customer_name=$customer_name order_id=$orderId}}
                                    </td>
                                </tr>
                            </tbody>
                        </desk>
                    </td>
                </tr>
                <tr>
                    <td bgcolor="#EAEAEA" align="middle" fashion="background:#EAEAEA;text-align:middle;">
                        <middle>
                            <p fashion="font-size:12px;margin:0;">
                                <sturdy>{{trans "Thanks"}}</sturdy>
                            </p>
                        </middle>
                    </td>
                </tr>
            </desk>
        </td>
    </tr>
</desk>
{{template config_path="design/e-mail/footer_template"}}

Step 3 -> Load template with dynamic variables and ship mail.

/** @var $storeManager MagentoStoreModelStoreManagerInterface $storeManager **/
/** @var $transportBuilder MagentoFrameworkMailTemplateTransportBuilder **/
/** @var $inlineTranslation MagentoFrameworkTranslateInlineStateInterface **/
$storeManager = $objectManager->create(MagentoStoreModelStoreManagerInterface::class);
$transportBuilder = $objectManager->create(MagentoFrameworkMailTemplateTransportBuilder::class);
$inlineTranslation = $objectManager->create(MagentoFrameworkTranslateInlineStateInterface::class);
$templateOptions = [
    'area' => MagentoFrameworkAppArea::AREA_FRONTEND,
    'store' => $storeManager->getStore()->getId()
];
$templateVars =  [
    'orderId' => "#00000009",
    'customer_name' => "Amir Khan"
];
$from = ['email' => "[email protected]", 'title' => 'Admin'];
$inlineTranslation->droop();
$to = ['[email protected]'];
$transport = $transportBuilder->setTemplateIdentifier('hello_template')
                ->setTemplateOptions($templateOptions)
                ->setTemplateVars($templateVars)
                ->setFrom($from)
                ->addTo($to)
                ->getTransport();
$transport->sendMessage();
$inlineTranslation->resume();

Thanks 🙂

author-thumb


Amir Khan
3 Badges

12 Might 2023



Source_link

READ ALSO

The right way to Add WooCommerce Customized Product Filter on Store Web page

Watch out for imposing studying prices on customers

Related Posts

The right way to Add WooCommerce Customized Product Filter on Store Web page
Software

The right way to Add WooCommerce Customized Product Filter on Store Web page

May 29, 2023
Watch out for imposing studying prices on customers
Software

Watch out for imposing studying prices on customers

May 28, 2023
Demystifying MVP: The Basis of Profitable Software program Growth
Software

Demystifying MVP: The Basis of Profitable Software program Growth

May 28, 2023
Have fun Google’s Coding Competitions with a ultimate spherical of programming enjoyable
Software

Have fun Google’s Coding Competitions with a ultimate spherical of programming enjoyable — Google for Builders Weblog

May 28, 2023
UPSC Mains 2022 Normal Research Paper 2
Software

Nationwide Revenue at Present Value and Fixed Value

May 27, 2023
Java HashSet | Developer.com
Software

Java versus PHP | Developer.com

May 27, 2023
Next Post
April irradiance up for US and Mexico, down for Canada – pv journal Worldwide

April irradiance up for US and Mexico, down for Canada – pv journal Worldwide

POPULAR NEWS

AMD Zen 4 Ryzen 7000 Specs, Launch Date, Benchmarks, Value Listings

October 1, 2022
Benks Infinity Professional Magnetic iPad Stand overview

Benks Infinity Professional Magnetic iPad Stand overview

December 20, 2022
Migrate from Magento 1 to Magento 2 for Improved Efficiency

Migrate from Magento 1 to Magento 2 for Improved Efficiency

February 6, 2023
Only5mins! – Europe’s hottest warmth pump markets – pv journal Worldwide

Only5mins! – Europe’s hottest warmth pump markets – pv journal Worldwide

February 10, 2023
Magento IOS App Builder – Webkul Weblog

Magento IOS App Builder – Webkul Weblog

September 29, 2022

EDITOR'S PICK

Simulating matter on the quantum scale with AI

Simulating matter on the quantum scale with AI

January 19, 2023
The way to pitch me: 7 buyers talk about what they’re searching for in March 2023

The way to pitch me: 7 buyers talk about what they’re searching for in March 2023

March 16, 2023
The 5 Levels of Machine Studying Validation | by Joel Hodgson | Nov, 2022

The 5 Levels of Machine Studying Validation | by Joel Hodgson | Nov, 2022

December 9, 2022
NVIDIA Formally Responds to 12VHPWR Scenario with Energy Connector Replace

NVIDIA Formally Responds to 12VHPWR Scenario with Energy Connector Replace

November 19, 2022

Insta Citizen

Welcome to Insta Citizen The goal of Insta Citizen is to give you the absolute best news sources for any topic! Our topics are carefully curated and constantly updated as we know the web moves fast so we try to as well.

Categories

  • Artificial Intelligence
  • Computers
  • Gadgets
  • Software
  • Solar Energy
  • Technology

Recent Posts

  • ClearVue’s Photo voltaic Home windows Get $2M Funding from WA Authorities
  • Arm launches new chips for quicker smartphone efficiency throughout Computex
  • Elon Musk’s Texas campus raises environmental considerations for locals
  • Expertise Innovation Institute Open-Sourced Falcon LLMs: A New AI Mannequin That Makes use of Solely 75 % of GPT-3’s Coaching Compute, 40 % of Chinchilla’s, and 80 % of PaLM-62B’s
  • Home
  • About Us
  • Contact Us
  • DMCA
  • Sitemap
  • Privacy Policy

Copyright © 2022 Instacitizen.com | All Rights Reserved.

No Result
View All Result
  • Home
  • Technology
  • Computers
  • Gadgets
  • Software
  • Solar Energy
  • Artificial Intelligence

Copyright © 2022 Instacitizen.com | All Rights Reserved.

What Are Cookies
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT