Guest User

Untitled

a guest
Jan 16th, 2019
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. var express = require("express");
  2. var router = express.Router();
  3. const nodemailer = require("nodemailer");
  4.  
  5. /* GET home page. */
  6. router.get("/", function(req, res, next) {
  7. res.render("index", { title: "Express" });
  8. });
  9.  
  10. /* Send mail */
  11. router.get("/askForCookiesRecipe", function(req, res, next) {
  12. console.log("hi");
  13. var transport = nodemailer.createTransport({
  14. host: "smtp.mailtrap.io",
  15. port: 2525,
  16. auth: {
  17. user: "4df13d539d4b0e",
  18. pass: "a60dc7d740324d"
  19. }
  20. });
  21. transport.sendMail(
  22. {
  23. from: "b9cccc489d-13dec5@inbox.mailtrap.io", // Expediteur
  24. to: "supergrandma@yopmail.com", // Destinataires
  25. subject: "Rectte cookies !", // Sujet
  26. text: "Coucou Mamie, comment vas tu? ✔", // plaintext body
  27. html:
  28. "<b>Peux tu me donner ta recette de cookies que j'adore, please! ✔</b>" // html body
  29. },
  30. (error, response) => {
  31. if (error) {
  32. console.log(error);
  33. } else {
  34. console.log("Message sent: " + response.message);
  35. }
  36. }
  37. );
  38. });
  39. module.exports = router;
Add Comment
Please, Sign In to add comment