0.3.0 • Published 4 years ago
pronto-email-service v0.3.0
Pronto Email Service
For sending emails. Currently supports AWS SES and SendGrid.
API
Exposes a single method sendEmail(email, cb)
.
Email fields are defined in the MailComposer documentation, most importantly you will need to
and from
addresses, a subject
, and a text
and/or html
body.
email = {
"to": "Test Jones <test@jones.net>",
"from": "Example Sender <sender@example.com>",
"subject": "Hi I am an email",
"html": "<h1>HELLO</h1><p>Just testing, carry on now.</p>"
}
Setup
Initialize the email service with a config
object, declaring and configuring one of the available providers.
ProntoEmailService = require 'pronto-email-service'
{sendEmail} = ProntoEmailService(config)
AWS SES config
Note: Region and access keys may be defined by environment variables (e.g. for a Lambda service).
config = {
"provider": "ses",
"region": "us-east-1",
"accessKeyId": "abc123",
"secretAccessKey": "def456"
}
SendGrid config
config = {
"provider": "sendgrid",
"api_key": "def456"
}