Postal for Node
**
documentation in progress for migration to TypeScript.
TS version works similar to the original nodeJS version below, just follow the types.
**
This library helps you send e-mails through the open source mail delivery
platform, Postal in Node.
Installation
Install the library using NPM:
$ npm install @bettercorp/postal --save
Usage
Sending an email is very simple. Just follow the example below. Before you can
begin, you'll need to login to your installation's web interface and generate
new API credentials.
import { SendMessage as PostalClient } from '@bettercorp/postal';
const client = new PostalClient('postal.yourdomain.com', 'your-api-key');
let message = client.to('john@example.com');
message.to('mary@example.com');
message.cc('mike@example.com');
message.bcc('secret@awesomeapp.com');
message.from('test@test.postal.io');
message.subject('Hi there!');
message.plainBody('Hello world!');
message.htmlBody('<p>Hello world!</p>');
message.attach('textmessage.txt', 'text/plain', 'Hello world!');
await message.send()