Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. var nodemailer = require('nodemailer');
  2.  
  3. module.exports = function (ctx, done) {
  4. var transporter = nodemailer.createTransport({
  5. service: 'gmail',
  6. auth: {
  7. user: ctx.data.notifierMailUser,
  8. pass: ctx.data.notifierMailPassword
  9. }
  10. });
  11.  
  12. var mailOptions = {
  13. from: ctx.data.notifierMailUser,
  14. to: ctx.data.receiverMailUser,
  15. subject: 'Custom GitHub Notification',
  16. text: ctx.body ? JSON.stringify(ctx.body, null, 4) : "No information was provided, you should check github"
  17. };
  18.  
  19. transporter.sendMail(mailOptions, function(error, info){
  20. if (error) {
  21. done(null, error);
  22. } else {
  23. done(null, 'Email sent: ' + info.response);
  24. }
  25. });
  26.  
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement