postal-ts
v1.0.4
Published
Typescript SDK for Postal Server, an open source mail delivery platform
Readme
Postal Server SDK for TypeScript
Welcome to Postal Server SDK for TypeScript! 🎉
This is a friendly and easy-to-use library for interfacing with the open source mail delivery platform, Postal. It's written in TypeScript, to provide type safety and autocompletion for a better developer experience. Our aim is to make sending emails as enjoyable and as painless as possible!
Installation
You can easily install this SDK with npm:
npm install postal-tsOr with yarn:
yarn add postal-tsUsage
Here's a simple example of how to send an email ✉️ with this SDK:
import { Postal } from "postal-ts";
const postal = new Postal("postal.your-domain.com", "your-server-key");
postal.send({
from: "[email protected]",
to: "[email protected]",
subject: "Hello, Postal!",
body: "This is a simple test email.",
});You can also use an html body just with the isHtml label:
postal.send({
...
body: "<h1>This is an awesome title</h1><p>Followed by a paragraph</p>",
isHtml: true,
})Do you have multiple recipients? Just use an array:
postal.send({
to: ["[email protected]", "[email protected]"],
...
})You can also add cc, bcc, sender and replyTo fields:
postal.send({
cc: "[email protected]",
bcc: "[email protected]",
sender: "[email protected]",
replyTo: "[email protected]",
...
})You can also pass an array for cc and bcc fields:
postal.send({
cc: ["[email protected]", "[email protected]"],
bcc: ["[email protected]", "[email protected]"],
...
})The send method returns sent messages with their ids:
const { id, messages } = await postal.send(...);Acknowledgements
Huge thanks to the creators of Postal, the open source mail delivery platform that inspired this project. We are standing on the shoulders of giants! 🙏 Check out their official documentation to learn more about what you can do with Postal and this SDK.
Contributing
As an open source project, we welcome contributions of all sorts! Whether it's filing an issue, fixing a bug, improving documentation, or adding a new feature, your contributions are greatly appreciated. Please take a look at our Contributing Guidelines for more information on how you can contribute.
License
This project is licensed under the MIT License.
Questions? Need Help?
Please don't hesitate to open an issue if you have any questions or need any help. We're here to help you out! You can also reach us at [email protected].
Happy emailing! 💌
Made with 🖤 by Widenex
