Giter Site home page Giter Site logo

dpd-sparkpost-mail's Introduction

dpd-spakpost-mail

Simple integration of sparkpost mail with deployd

Install

npm i dpd-sparkpost-mail --save

Usage

Go to your dashboard and create SparkpostMail resource and enter the requested info To send an email just call the post method of the mail resource you have created

dpd.sparkpostmail.post({
      secret: 'sdfa7sda9f76s9af6',
      from: '"From Someone" <[email protected]>',
      to: '[email protected]',
      subject: 'Hakuna Matata',
      html: '<h2>Aloha</h2><br>Don\'t worry, be happy'
      delay_minutes: 30,
      delay_hours: 1
    }, function(result, error) {
      console.log(error);
      console.log(result);
    });

delay_minutes and delay_hours are optional, the defautl value for this is 0. Set that values only if you want do schedule/delay the email delivery.

Using Templates

You can specify a template id and substitution data instead content

dpd.sparkpostmail.post({
      to: '[email protected]',
      template_id: 'my-template-id',
      substitution_data:{
        key:value,
        key2:value2,
      }
    }, function(result, error) {
      console.log(error);
      console.log(result);
    });

substitution_data field is optional

Change sparkpostmail with your resource name

Templates integration coming for the next release, it's already coded, just need a few tweaks, feel free to modify it to get it work with templates.

Support

For any help post an issue or write to [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.