Skip to content

Send email when Survey is created #25

Description

@DanielLarsenNZ

As a user, I would like to receive an email when I create a new Survey.

  • Include Survey Link (bitly) and QR code.
  • Use Mandrill + Powerdrill (NPM)

From @quipu :

api/services/EmailService.js

var email = require('powerdrill')(sails.config.mandrill_key);
module.exports = {
  /**
   * SEND A SIGN-UP CONFIRMATION EMAIL
   * Email uses a template set up in Mandrill
   * @param user
   */
  signUpConfirm : function (user) {
     var message = email();
     message
        .template('sign-up-confirmation')
        .to(user.email, { fname : user.given_name });
     message.send(function (err, resp) {
        if(!resp[0]) {
           sails.log.error('fn=EmailService.signUpConfirm status=fail msg="uncaught exception"');
           return false;
        }
        if(resp[0].status != 'sent') {
           sails.log.error('fn=EmailService.signUpConfirm status=fail msg="%s"', resp[0].reject_reason);
           return false;
        }
        sails.log.debug('fn=EmailService.signUpConfirm status=success');
     });
  },

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions