index.js 547 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const config = require('config');
  3. const mailgun = require('mailgun-js')({apiKey: config.get("apis.mailgun.key"), domain: config.get("apis.mailgun.domain")});
  4. let lib = {
  5. schemas: {},
  6. init: (cb) => {
  7. lib.schemas = {
  8. verifyEmail: require('./schemas/verifyEmail'),
  9. resetPasswordRequest: require('./schemas/resetPasswordRequest'),
  10. passwordRequest: require('./schemas/passwordRequest')
  11. };
  12. cb();
  13. },
  14. sendMail: (data, cb) => {
  15. if (!cb) cb = ()=>{};
  16. mailgun.messages().send(data, cb);
  17. }
  18. };
  19. module.exports = lib;