@kassellabs/mail-server-api
v0.1.0
Published
Kassel Labs mailing api client
Downloads
11
Readme
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: '[email protected]', // Must be @kassellabs.io
to: '[email protected]' // can also be an array of strings,
replyTo: '[email protected]', // optional, defaults to "[email protected]"
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: '[email protected]', // can also be an array of strings
replyTo: '[email protected]', // optional, defaults to "[email protected]"
// 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',
...
},
});