@salestrip/emailer
v1.1.4
Published
Send emails with attachments
Downloads
478
Keywords
Readme
@salestrip/emailer
SalesTrip Engine emailer library
Sends emails with optional attachments that are base64 string encoded.
Instructions
npm i @salestrip/emailer
Usage
Required fields
const emailer = require('@salestrip/emailer')
exports.send = function() {
const payload = {
kind: EMAIL_KINDS_ENUM,
to: '[email protected]', // only one recipient
subject: STRING,
model: {}
}
return emailer.create(payload)
}
Optional fields
If attachments are included then the specified fields are required. Sendgrid does not document how many attachments can be sent so as a precaution only 2 attachments can be sent.
const emailer = require('@salestrip/emailer')
exports.send = function() {
const payload = {
kind: EMAIL_KINDS_ENUM,
to: '[email protected]',
cc: ['[email protected]'],
bcc: ['[email protected]'],
from: '[email protected]', // defaults to [email protected]
subject: STRING,
model: {},
attachments: [
{
type: 'application/pdf',
filename: 'my-file.pdf',
content: 'base64 encoded string'
}
]
}
return emailer.create(payload)
}
Release
To release a new version, use npm. Using npm version
will update the version in package.json
before committing the resulting file change to git and adding the appropriate git tag. Pushing a tagged version to origin
will trigger a CI deployment to the npm registry.
To release a bugfix update the patch version.
npm version patch
git push
git push --tags
To release a feature update the minor version.
npm version minor
git push
git push --tags
To release a breaking change update the major version.
npm version major
git push
git push --tags
License
Copyright © 2018-2020 SalesTrip Limited. All rights reserved.