Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

...

Codeblock
languagebash
umkickstarter -n de.pinuts.tutorial
cd umkickstarter
# Copy your partner license file to env/devel/cmsbs-conf/cmsbs.license
gradle setup run

Create Newsletter Template

...

Now manually create a List named offerlist and some Entries with email addresses that are subscribed to that list.

...

Goto Tools / Mail Log to verify that emails have been sent and actually do contain the dynamically generated content.

Send Newsletter programmatically

If you also want to start sending the above Newsletter programmatically – i.e. by a Cronjob – you can create an EventFile and trigger sending with the following code snippet.

cmsbs-conf/cse/plugins/de.pinuts.tutorial/shared/SendOfferListNewsletter.es6:

Codeblock
languagejs
/// <reference path="../../../.vscode.js"/>

const MAILING_TEMPLATE_NAME = 'offerlist-nl';
const CHANNEL_NAME = 'offerlist';
const NEWSLETTER_TAG = 'offerlist';

function createEventFile() {
    return `<event archive="true">
        <destination>
            <channel>${Strings.encodeXml(CHANNEL_NAME)}</channel>
        </destination>
        <data>
            <message>${Strings.encodeXml(MAILING_TEMPLATE_NAME)}</message>
            <email archiveOutgoingEmails="false" obeyPreferHtml="false" sendBothParts="false" trackingMode="Off"></email>
        </data>
        <tag>${Strings.encodeXml(NEWSLETTER_TAG)}</tag>
    </event>`;
}

export function run() {
    UM.println('Preparing newsletter...');

    const eventFile = createEventFile();
    UM.newsletterArchive.send(eventFile);
}

de.pinuts.tutorial.sendNewsletter = run;

Having done that you can create a CSE: Call Cronjob to periodically call de.pinuts.tutorial.sendNewsletter().