postal-node-ts
v1.1.6
Published
This library is a typescript rewrite of [Postal Node](https://github.com/postalserver/postal-node).
Maintainers
Readme
Postal for Node
This library is a typescript rewrite of Postal Node.
Installation
Install the library using NPM:
$ npm install postal-node-ts --saveUsage
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 { Client, SendMessage, SendRawMessage, SendResult } from 'postal-node-ts'
console.log(Client);
console.log(SendMessage);
console.log(SendRawMessage);
const client = new Client('test.postal.io', 'your-api-key');
const message = new SendMessage(client);
// Add some recipients
message.to('[email protected]');
message.from('[email protected]');
message.subject('Hi there!');
message.plainBody('Hello world!');
message.htmlBody('<p>Hello world!</p>');
message.send().then((result: SendResult) => {
console.log(result.result);
})
.catch((error: any) => {
console.error(error);
});