How to use the default HTML email template when sending an email from a plugin?

On /admin/settings/email, when the HTML Email Template field is set to a valid template, all system messages are sent using it. They inject the content of the messages inside the {% block main %}{{body}}{% endblock %} variable.

From a custom plugin, setHtmlBody doesn’t inject the content inside it. It takes its value as the whole template value instead of only replacing the {{body}} variable.


$message->setSubject("Hello world.");
$message->setHtmlBody("Hello world.");

How can I send this email using the custom HTML email template specified in my CP Email Settings?

I could copy-paste the whole file content of my custom template inside the setHtmlBody, but it doesn’t seems to be a clean way…

All topic

How can I add name of Journal in BMC Template?

I would like to add Journal name on the right top at first page. For the reference, I herewith attach one paper. enter link description here

All topic

create my template installer from Visual Studio installer in Visual Studio 2017

I have a standard application that i customize by client.
each time i deploy i have to create am MSI for that client.

Each time i create a Setup Project from the Visual Studio Installer.
then i have a lot of parameter that are the same ex: manufacturer, company, icon etc.

I tried and tried and wonder if it is Possible to create my own Project Template from the Setup Project of Visual Studio Installer.

Note: I use Visual Studio 2017 Community .
the export Template is disabled in the project menu.
I tried openning VS in Admin mode.
i tried to temper the *.vstemplate file….

Is there a way to accomplish this ?

Thank you

All topic

Ubuntu 18.04 : Trigger scripts when VMware template is cloned

I am trying to trigger some scripts only once when an Ubuntu 18.04 template is cloned.

Is there anyway to setup cloud-init and clone to VM to template? I couldn’t found how and where this can be done. On my current VM which will serve as a template cloud-init has the boot-finished. I was planning to use upstart and at the end of the script remove all assets, but it seems to be a bit barbarian.

Would you please provide any advice?

All topic

Case feed QuickActionDefaultsHandler- Selecting a default email template not working

Since Spring 15 it is possible to select a default email template by using a QuickActionDefaultsHandler. According to the docs you only need to:

To specify default values for the standard Email Action on Case Feed,
create a class that implements QuickAction.QuickActionDefaultsHandler.

So I wrote this:

global class EmailComposer implements QuickAction.QuickActionDefaultsHandler {

    public static String DEFAULT_RESPONSE_TEMPLATE = 'Branded_Standard';

    global EmailComposer() { }

    // The only interface method
    global void onInitDefaults(QuickAction.QuickActionDefaults[] defaults) {

        QuickAction.SendEmailQuickActionDefaults sendEmailDefaults = getSendEmailFromCaseDefaults(defaults);

        if (sendEmailDefaults == null) return;

        EmailMessage emailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject();   

        // set the template 
        List templates = [select id from EmailTemplate where developername = : DEFAULT_RESPONSE_TEMPLATE limit 1];
        if (templates.size() == 0) return;



    private QuickAction.SendEmailQuickActionDefaults getSendEmailFromCaseDefaults(QuickAction.QuickActionDefaults[] defaults) {
        QuickAction.SendEmailQuickActionDefaults item;

        for (Integer j = 0; j < defaults.size(); j++) {

            if (!(defaults.get(j) instanceof QuickAction.SendEmailQuickActionDefaults)) continue;

            item = (QuickAction.SendEmailQuickActionDefaults)defaults.get(j);
            if (item.getTargetSObject().getSObjectType() == EmailMessage.sObjectType &&
               item.getActionName().equals('Case.Email') &&
               item.getActionType().equals('Email')) {
                return item;

        // couldn't find the defaults
        return null;

Is there anywhere that I need to register this class? The specified template exists, but it is not automatically selected for new emails on a case.

All topic

VMWare Template Ubuntu 18.04 Trigger Script

I am trying to trigger some scripts only once when an ubuntu 18.04 template is cloned.

Is there a way to setup cloud-init and clone to VM to template ? I didnt found how and where this could be done.

On my current VM who will serve as a template cloud-init has the boot-finished .

I was planning to use upstart and at the end of the script remove all assets but it seems to be a bit barbarian.

Any hint would be grateful 🙂 Thank you for your time

All topic

Using “react-script-editor” is preventing me from saving the team site as template. any workarounds

I am working on a sharepoint online classic team sub-site, and i added the React Script Editor webpart from to allow me to add custom scripts inside modern pages. so i went to the sub-site’s site content link >> i add the web part app, as follow:-

enter image description here

After that i reference the web part inside the sub-site’s home page, and i added a javascript inside it. then i tried to save the sub-site as template but i got this error:-

Sorry, something went wrong Sorry, this site can’t be saved as a
template. It contains apps that don’t work in templates: Modern
Script Editor web part by Puzzlepart

as follow:-

enter image description here

so my question is; if there is a way to add the web part to my sub-site and be able to save the sub-site as template? have any one find a workaround, or a way to make have this working ?


All topic

Template not found 404

Having a strange issue – devMode is set to false, if I go to /404, I get the custom 404 page, which is great.

If I go to /something1234567890 (which is definitely not an entry’s URL) I get the following exception:

yiiwebNotFoundHttpException: Template not found: something1234567890

I have tried adding debugging to my base templates but it looks like it is not getting as far as them.

Does anyone have an idea where I can start trying to debug this?

All topic

Any ideas on how to remove a knockout template from M2 (at the checkout)?

The template in question is vendor/magento/module-sales-rule/view/frontend/web/template/payment/discount.html and it shows at the checkout

The rule that places the template in vendor/magento/module-sales-rule/view/frontend/layout/checkout_index_index.xml is


All topic

Magento 2 Adding a custom block template to CMS page

I’m struggling including my custom module/block template into a static CMS page.

Here’s my block code:

How would I implement this in a static CMS page?

All topic