@kassellabs/mail-server-api

0.1.0 • Public • Published

Kassel Labs Mail Server API

This is a client made to make Kassel Labs mailing system easier

How to Use

First you need to initialize your client with your credentials

const MailServerApi = require('@kassellabs/mail-server-api');

const mailApi = MailServerApi({
  url: '<the url from your broker goes here>',
});

Then you're ready to send e-mails

Sending Common HTML or Text e-mails

To send e-mails, you can use the basic mailing API

mailApi.sendEmail({
  from: 'foo@kassellabs.io', // Must be @kassellabs.io
  to: 'foo@gmail.com' // can also be an array of strings,
  replyTo: 'no-reply@kassellabs.io', // optional, defaults to "support@kassellabs.io"
  subject: 'Just wanna say Hi', // optional

  html: '<div>Hi</div>',
  // or
  text: 'Hi',
});

Sending Template E-mails

Sending template e-mails will enable you to send templates e-mails that are already included on the mail-server, check its code to see them.

mailApi.sendTemplateEmail({
  template: 'video-is-ready' // Must be one of the available templates within mail-server
  to: 'foo@gmail.com', // can also be an array of strings
  replyTo: 'no-reply@kassellabs.io', // optional, defaults to "support@kassellabs.io"

  // This data is related to the template you'll send, you'll have to check
  // which variables your template accepts to know what you can send on its
  // context
  context: {
    name: 'John Doe',
    code: 'JHND',
    ...
  },
});

Readme

Keywords

Package Sidebar

Install

npm i @kassellabs/mail-server-api

Weekly Downloads

4

Version

0.1.0

License

MIT

Unpacked Size

3.27 kB

Total Files

3

Last publish

Collaborators

  • nihey
  • brorlandi