Socket
Socket
Sign inDemoInstall

accelerated.api.emails

Package Overview
Dependencies
5
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    accelerated.api.emails

Emails for accelerated.api.


Version published
Maintainers
1
Install size
4.30 MB
Created

Readme

Source

Usage

This module uses Postmark to deliver emails. As such, please register with http://postmarkapp.com and get your API token key. Then define the following in your accelerated.api env.json:

"POSTMARK_API_TOKEN": "Postmark-API-Token",
"POSTMARK_FROM": "Postmark-From-Email-Address"

With accelerated.api, you define your own model. In your CommonJS model, use the models direct injected variable as such:

var toEmail = 'recipient@email.com';
var emailTemplate = ['onExample', __dirname]; 

/*
First value represents the dir where folder templates exists.
Second value represents the email template name that is used.
*/

models.emails.sendTo(toEmail, emailTemplate, {
	firstName: 'User' 
}, function(success) {
	console.log('Email sent!');
}, function(error) {
	console.log('Something went wrong!');
});

/*
In your emails module, where you're executing models.emails.sendTo,
create a folder "templates". 

For any new template, follow this file format in that "templates" folder:

project/
	|__ /index.js
	|__ /templates
		|__ /templateNameBody.html
		|__ /templateNameSubject.txt

In _Body.html and _Subject.txt files, use Mustache templating for rendering
any passed through data object properties.
*/


var api = require('accelerated.api');

var apiEmails = require('acceleratd.api.emails').use();

api.useModels([ 
	[apiEmails.key, apiEmails.model]
]);

api.run();

FAQs

Last updated on 20 Jul 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc