0.1.0 • Published 3 years ago

@kassellabs/mail-server-api v0.1.0

Weekly downloads
5
License
MIT
Repository
-
Last release
3 years ago

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',
    ...
  },
});
0.1.0

3 years ago

0.0.1

4 years ago

0.0.0

4 years ago