@salestrip/emailer

1.1.4 • Public • Published

@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: 'customer@salestrip.com', // 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: 'customer@salestrip.com',
    cc: ['another@email.com'],
    bcc: ['another@email.com'],
    from: 'engineering@salestrip.com', // defaults to no-reply@salestrip.com
    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.

Readme

Keywords

none

Package Sidebar

Install

npm i @salestrip/emailer

Weekly Downloads

139

Version

1.1.4

License

UNLICENSED

Unpacked Size

147 kB

Total Files

70

Last publish

Collaborators

  • srivai.vignesh
  • gmanojkumar
  • jmelville
  • vinodkrsalestrip
  • hemanthstrip