Guest User

Untitled

a guest
Apr 17th, 2018
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. // /askForCookiesRecipe
  2. router.get('/askForCookieRecipe', (req, res, next) => {
  3. emailSender();
  4. next();
  5. });
  6.  
  7. // fonction qui envoie un email
  8. const emailSender = () => {
  9. let transporter = nodemailer.createTransport({
  10. host: 'smtp.gmail.com',
  11. port: 465,
  12. secure: true,
  13. auth: {
  14. user: '**********',
  15. pass: '**************'
  16. }
  17. });
  18.  
  19. let message = {
  20. from: '"SlenderMan👻" <slenderman@gmail.com>',
  21. to: '"LUDWIG" <vantoursludwig@gmail.com>',
  22. subject: 'HELLO BUDDY!',
  23. text: 'if you run, i\'ll catch you',
  24. html: '<p><b>MOUHAHAHAHA</b></p>'
  25. };
  26.  
  27. transporter.sendMail(message, (err, info) => {
  28. if (err) {
  29. console.log('Error occurred. ' + err.message);
  30. return process.exit(1);
  31. }
  32.  
  33. console.log('Message sent: %s', info.messageId);
  34. });
  35.  
  36. };
Add Comment
Please, Sign In to add comment