This provides a sails hook integrating Mailin within your app. Mailin is an smtp server that listens for emails and parses them as json.
Install
$ npm install sails-hook-mailin --save
Usage
1. configure .sailsrc
2. install sails.js extension
$ sails generate mailin-api
This create the Mailin Service event handler, and config. The default service name is MailinService
, to use a different name instead use
$ sails generate mailin-api MyCustomMailinService
Configuration
Simply modify the generated config/mailin.js
to modify the options
moduleexportsmailin = // Enable/Disable mail server enable: true // Mail Port port: 2500 // Service to handle incoming mail handlerService: MailinService
Service Handler
Modify generated service handle, add methods for events you want to listen for
// api/services/MailinService.jsmoduleexports = // Validate email recipient { ifemail != "dprietti@test.com" return ; ; } // Message was received and parsed. { console; } ;
For all possible event methods, see Mailin Events