Skip to content
Open in

Sending testing emails ​

Pressing the send button in the editor preview converts the template to HTML and hands it to the onTestSend callback, which carries everything needed to send a test message through your own sender.

js
const editor = TopolEmailEditor({
  config: TOPOL_OPTIONS,
  onTestSend({ email, json, html }) {
    // send a testing email using your sender of choice
  },
});

Sending to multiple addresses ​

Setting the testingEmails option switches test sends into multi-recipient mode, where the preview shows a multi-select of saved addresses instead of a single input.

INFO

In multi-recipient mode the email property in the callback payload is always an array, even when only one address is selected.

Emails saved in local storage ​

Setting testingEmails to true stores the recipient list in local storage, which keeps it across sessions on the same browser.

js
testingEmails: true;

Managing the addresses yourself ​

Setting testingEmails to an array seeds the editor with those addresses, up to a maximum of five (anything beyond the fifth is dropped).

js
testingEmails: ["user1@example.test", "user2@example.test"];

In this mode, edits to the list are reported through the onTestingEmailsChange callback so the new list can be persisted server-side.

js
const editor = TopolEmailEditor({
  config: TOPOL_OPTIONS,
  onTestingEmailsChange({ emails }) {
    // save the updated list to your DB
  },
});