kabam-plugin-notify-email

Kabam plugin to notify users by email. Binds to kabam-kernel event system

npm install kabam-plugin-notify-email
12 downloads in the last month

kabam-plugin-notify-email

Kabam-kernel plugin to notify users by email. Binds to Kabam-kernel event emiting system and user.notify function

Requires

  • This plugin depends on view engine being installed (kabam-plugin-hogan)
  • Email Templates are in ./views/emailTemplates directory from the basepath of the application
  • The configuration should set EMAIL_CONFIG, which is best set in environment variable. Currently it only works with gmail, with the format of 'username@gmail.com':'password'

Usage

Sample usage of sending an email to a user in the application:


    kernel.model.Users.findOne({'username':'johndoe'},function(err,userFound){
      userFound.notify('email','Hello!'); // send simple message
      userFound.notify('email',{
        'subject':'Important',
        'template':'important',
        'message':{ //can have every structure that can be rendered by template engine
          'memo':'This is very imnportant',
          'numbers' : [1,2,3,5,6],
          'items':{ crowbar:{'size':'XL'}, 'hammer':{'size':'XXL'} }
        }
      }); // send message with custom template
    });

The template for that email should be stored on ./views/emailTemplates/important.html It will provide the user data in user object and the custom data in message object. The template language supported is mustache but we use [[ and ]] tags to avoid conflicts with angular tags.

Sample template:

<!DOCTYPE html>
<html>
<body>
  <p>Hello [[user.username]]</p>
  <p>Memo:</p>
  <p>[[message.memo]]</p>
</body>
</html>

Current lead developer for this package is T. Budiman Former lead developer: Anatolij Ostroumov

npm loves you