@tshio/mailer-client
v0.0.1
Published
RAD Mailer Client
Downloads
1
Readme
RAD Mailer Client
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: "[email protected]",
},
recipient: {
to: ["[email protected]"],
},
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
This project is licensed under the terms of the MIT license.
About us:
The Software House