Advertisement
Guest User

Untitled

a guest
Apr 11th, 2019
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. const nodemailer = require('nodemailer');
  2. var router = express.Router();
  3.  
  4.  
  5. router.post('/askForCookiesRecipe', function(req, res, next) {
  6. const transporter = nodemailer.createTransport("SMTP",{
  7. service: "yopmail",
  8. auth: {
  9. user: "supergrandma@yopmail.com",
  10. pass: "passwordgrandma"
  11. }
  12. });
  13.  
  14. const mailOptions = {
  15. from: "myEmail@gmail.com",
  16. to: "supergrandma@yopmail.com",
  17. subject: `Cookies Recipe `,
  18. text: `Please Grand Ma, Could you give me your cookie recipe... It's for my birthday... Don(t forget my gift ;)`,
  19. html: `Please Grand Ma, <strong>Could you give me your cookie recipe... </strong> It's for my birthday... Don(t forget my gift ;)`
  20. };
  21.  
  22. transporter.sendMail(mailOptions, function(err, res) {
  23. if (err) {
  24. console.error('there was an error: ', err);
  25. } else {
  26. console.log('here is the res: ', res)
  27. }
  28. });
  29.  
  30. });
  31.  
  32. module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement