Trebuchet
Let's chuck some email!
Trebuchet is a node.js module for super simple email transactions using the Postmark API and Mustache with Juice for templating. Trebuchet was designed with simple email rendering, batching and API operations in mind.
Installation
npm install trebuchet
Basic Use (Fling Pattern)
var trebuchet = 'yourapikey'; trebuchet;
Basic Use (Fling Pattern with HTML friendly inlined-CSS support)
var trebuchet = 'yourapikey'; trebuchet;
Batch Sender (Load --> Fire Pattern)
The batch sender uses the Postmark API's batch method to support sending groups of messages (up to 500 at a time).
NOTE: You can also pass a css variable to load a stylesheet that will be inlined using juice
.
var trebuchet = 'yourapikey'; trebuchet;
trebuchet;
Templating
Trebuchet uses Mustache templates to make sending dynamic HTML and plain-text emails super-duper simple.
NEW: We've added support Juice which allows one to pass a css
variable and inline the CSS with the HTML template for email-friendly CSS... KA POW!
An example template:
{{greeting}}
With example data:
greeting: 'Hello World!'
Result (without CSS argument):
Hello World!
Result (with CSS argument, e.g. "some/path/to/template.css"):
Hello World!
Pre-rendered content
Trebuchet also accepts pre-rendered strings and buffers. Simply add the prerendered flag and ommit the data in your options.
var trebuchet = 'yourapikey'; trebuchet;
Testing
npm test