@tshio/mailer-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

RAD Mailer Client

npm version

Non-blocking RAD Mailer client for Node.js.

This is a 100% JavaScript library, with TypeScript definition, with the Promise API.

This module makes it simple to implement a Node.js application that uses RAD Mailer.

Table of Contents

Installing

$ npm install @tshio/mailer-client

or

$ yarn add @tshio/mailer-client

Loading and configuration module

// CommonJS
const { MailerClient } = require('@tshio/mailer-client');

// ES Module
import { MailerClient } from '@tshio/mailer-client';


const options = {
  host: "localhost",
  port: "50060",
}

const mailerClient = new MailerClient(options);

Getting started

Send email

const request: SendRequest = {
emails: [
  {
    sender: {
      name: "tsh.io",
      email: "sender@example.com",
    },
    recipient: {
      to: ["recipient@example.com"],
    },
    template: {
      id: "test",
      parameters: {
        firstName: "Antonio",
        lastName: "Hernández",
      },
    },
  },
],
}

await mailerClient.mailer.send(request);

API

mailerClient.mailer.send({ emails, priority }) => Promise< void >

Send emails

Returns void or throw HttpError

Parameters
Name Type Description Default
messages object[] Array of MailMessage
priority string optional

Send priority, allowed values: urgent, high, medium, low

urgent
Mail message
Name Type Description Default
sender object Sender object
sender.name string Sender name
sender.email string Sender email
recipient object Recipient object
recipient.to string[] Recipient to
recipient.cc string optional

Recipient bcc

recipient.bcc string optional

Recipient bcc

template object Template object
template.id string Template id
template.parameters object Template parameters
attachments object[] Attachments objects array
attachment.fileName string Attachments file name
attachment.content string Attachments content encoded with base64

License

license

This project is licensed under the terms of the MIT license.

About us:

The Software House

tsh.png

Readme

Keywords

none

Package Sidebar

Install

npm i @tshio/mailer-client

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

94.5 kB

Total Files

19

Last publish

Collaborators

  • vviktor
  • aherok
  • sethii
  • barograf